Add Client resource type and scopes to authorization schema#6
Conversation
…valuation implementation for ClientsPermissionsV2 Closes #35564 Signed-off-by: Martin Kanis <mkanis@redhat.com>
Codoki PR ReviewSummary: Avoid UOE on removal events, filter type resource Issues (Critical & High only)
Showing top 1 issues. Critical: 1, High: 0. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 2/5 — Not ready to merge (1 critical · status: Requires changes) Sequence DiagramsequenceDiagram
participant ProviderEventManager
participant AdminPermissions
participant MgmtPermissionsV2
participant ClientPermissionsV2
ProviderEventManager->>AdminPermissions: onEvent(ClientRemovedEvent)
AdminPermissions->>MgmtPermissionsV2: management(...).clients()
MgmtPermissionsV2-->>AdminPermissions: ClientPermissionsV2
AdminPermissions->>ClientPermissionsV2: setPermissionsEnabled(client, false)
alt V2 method throws UOE
ClientPermissionsV2-->>AdminPermissions: UnsupportedOperationException
end
React with 👍 or 👎 if you found this review useful. |
| } | ||
|
|
||
| @Override | ||
| public void setPermissionsEnabled(ClientModel client, boolean enable) { |
There was a problem hiding this comment.
🛑 Critical: This method throws UnsupportedOperationException in V2 but is still invoked by the AdminPermissions event listener on ClientRemovedEvent, causing a runtime crash when ADMIN_FINE_GRAINED_AUTHZ is enabled. Implement a no-op to preserve event flow and avoid crashes while keeping V2 semantics.
| public void setPermissionsEnabled(ClientModel client, boolean enable) { | |
| public void setPermissionsEnabled(ClientModel client, boolean enable) { | |
| // No-op in V2: permissions toggling is managed by policies, not per-entity flags | |
| } |
|
|
||
| Set<String> granted = new HashSet<>(); | ||
|
|
||
| resourceStore.findByType(server, AdminPermissionsSchema.CLIENTS_RESOURCE_TYPE, resource -> { |
There was a problem hiding this comment.
🔷 Medium: getClientsWithPermission likely includes the type-level 'Clients' resource, returning a non-client name (e.g., "Clients") alongside actual client IDs. Filter out the type-level resource to return only concrete clients.
| return false; | ||
| } | ||
|
|
||
| private EvaluationContext getEvaluationContext(ClientModel authorizedClient, AccessToken token) { |
There was a problem hiding this comment.
💡 Low: This helper is unused in V2 and increases maintenance burden; either remove it or integrate it where token-bound client authorization is evaluated.
| private EvaluationContext getEvaluationContext(ClientModel authorizedClient, AccessToken token) { | |
| /* Remove unused method to reduce maintenance surface in V2 */ |
No description provided.