-
Notifications
You must be signed in to change notification settings - Fork 0
Add Client resource type and scopes to authorization schema #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature-clients-authz-baseline
Are you sure you want to change the base?
Add Client resource type and scopes to authorization schema #6
Conversation
…valuation implementation for ClientsPermissionsV2 Closes #35564 Signed-off-by: Martin Kanis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile OverviewConfidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Admin as Admin User
participant API as Admin REST API
participant CPV2 as ClientPermissionsV2
participant APS as AdminPermissionsSchema
participant RS as ResourceStore
participant AuthZ as AuthorizationProvider
participant Client as ClientModel
Admin->>API: Request client operation (view/manage/configure)
API->>CPV2: Check permission (canView/canManage/canConfigure)
alt Check admin role first
CPV2->>CPV2: Check if user has MANAGE_CLIENTS or VIEW_CLIENTS role
CPV2-->>API: Return true if role exists
else Check V2 permissions
CPV2->>RS: findByName(server, clientId)
alt Client-specific resource exists
RS-->>CPV2: Return resource for client
else Fallback to "all-clients" resource
CPV2->>APS: getResourceTypeResource(CLIENTS_RESOURCE_TYPE)
APS->>RS: findByName(server, "Clients")
RS-->>APS: Return "all-clients" resource
APS-->>CPV2: Return resource
end
CPV2->>AuthZ: evaluatePermission(resourcePermission)
AuthZ-->>CPV2: Return granted permissions
CPV2->>CPV2: Check if requested scope (VIEW/MANAGE/CONFIGURE) is granted
CPV2-->>API: Return permission result
end
API->>Client: Execute operation if authorized
Client-->>API: Return result
API-->>Admin: Return response
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
server-spi-private/src/main/java/org/keycloak/authorization/AdminPermissionsSchema.java, line 310-322 (link)logic: Missing handling for CLIENTS resource type in
getResourceNamemethodThe method only handles USERS resource type but doesn't handle the newly added CLIENTS resource type. This will cause the display name to fall back to
resource.getDisplayName()for client resources, which may not provide proper display names in the admin UI.Add a similar block for CLIENTS:
10 files reviewed, 1 comment
Test 5
Replicated from ai-code-review-evaluation/keycloak-greptile#5