feat: add realm role and client role syncing and provisioning - #23
feat: add realm role and client role syncing and provisioning#23c1-dev-bot[bot] wants to merge 1 commit into
Conversation
Add three new resource types to expand Keycloak access provisioning beyond group membership to cover the full RBAC model: - Realm Role: syncs realm-level roles with Grant/Revoke provisioning for assigning/removing roles from users - Client: syncs Keycloak clients as parent resources for client roles - Client Role: syncs per-client roles with Grant/Revoke provisioning for assigning/removing client-specific roles from users This enables table-level access control by exposing all dimensions of Keycloak's access model (groups, realm roles, client roles) through ConductorOne's provisioning workflows. Fixes: CXH-1530
|
|
||
| if err := o.client.AddRealmRoleToUser(ctx, userID, role); err != nil { |
There was a problem hiding this comment.
🟡 Suggestion: Grant does not handle the "role already assigned" case as idempotent success. If Keycloak returns a distinguishable error when the user already has this realm role, catch it and return nil error with a GrantAlreadyExists annotation. Same applies to Revoke (line 144) for "role not assigned" → GrantAlreadyRevoked. The existing group builder has the same gap, but fixing it here would prevent spurious failures on retries. See also client_roles.go Grant (line 133) and Revoke (line 171).
Connector PR Review: feat: add realm role and client role syncing and provisioningBlocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0 Review SummaryThis PR adds three new resource types (realm role, client, client role) with sync and provisioning for realm/client roles, plus the corresponding client methods and capability declarations. The implementation follows existing connector patterns well — pagination, error handling, entity sources, resource ID stability, and parent hierarchy are all correct. One suggestion for idempotent Grant/Revoke handling. Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agents |
Summary
baton_capabilities.jsonto declare the new resource types and their capabilitiesThis expands the Keycloak connector from only group membership provisioning to covering the full RBAC model (groups + realm roles + client roles), enabling table-level access control through ConductorOne.
New Resource Types
realm_roleTRAIT_ROLEclientTRAIT_APPclient_roleTRAIT_ROLEAPI Methods Added
GetRealmRoles/GetUsersByRealmRoleName/AddRealmRoleToUser/DeleteRealmRoleFromUserGetClients/GetClientRoles/GetUsersByClientRoleName/AddClientRoleToUser/DeleteClientRoleFromUserAll methods use the existing
gocloak/v13library and follow the same authentication and pagination patterns as existing methods.Fixes: CXH-1530
Test plan
Automated PR Notice
This PR was automatically created by c1-dev-bot as a potential implementation.
This code requires: