Fix matchRole lookup to include group-inherited and composite roles #25

Merged
stb merged 2 commits from fix-role-membership into main 2026-07-18 14:14:44 +02:00
Owner

getRoleMembersStream only returns users with the role assigned
directly, so exported attributes silently excluded users who have
matchRole via group membership. Filter all realm users with
hasRole() instead, matching the resolution already used for authRole.

Closes #20

getRoleMembersStream only returns users with the role assigned directly, so exported attributes silently excluded users who have matchRole via group membership. Filter all realm users with hasRole() instead, matching the resolution already used for authRole. Closes #20
Fix matchRole lookup to include group-inherited and composite roles
All checks were successful
/ Verify (push) Successful in 1m8s
/ Verify (pull_request) Successful in 46s
2c3c0a3dab
getRoleMembersStream only returns users with the role assigned
directly, so exported attributes silently excluded users who have
matchRole via group membership. Filter all realm users with
hasRole() instead, matching the resolution already used for authRole.
stb requested reviews from june, kritzl, lilly 2026-07-12 13:08:32 +02:00
@ -121,1 +122,3 @@
Stream<UserModel> users = userProvider.getRoleMembersStream(realm, matchRole);
// getRoleMembersStream only returns users with matchRole assigned directly; it misses
// users who have the role via group membership (incl. parent groups) or composite roles.
// hasRole() resolves the role the same way authUser.hasRole(authRole) does above.
Member

this comment isn't that useful, after this PR is merged, as it references old code. Please write such information in the PR discussion

this comment isn't that useful, after this PR is merged, as it references old code. Please write such information in the PR discussion
stb marked this conversation as resolved
Remove superflous comment
All checks were successful
/ Verify (pull_request) Successful in 48s
/ Verify (push) Successful in 49s
db302eebb4
stb merged commit dfd10b16dc into main 2026-07-18 14:14:44 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#26 Add exporting individual attributes and a map endpoint
CCCHH/keycloak-attribute-endpoints-provider
Reference
CCCHH/keycloak-attribute-endpoints-provider!25
No description provided.