Allow custom protocol mappers to be recognized as organization-aware in OrganizationScope#49025
Open
kota65535 wants to merge 1 commit into
Open
Allow custom protocol mappers to be recognized as organization-aware in OrganizationScope#49025kota65535 wants to merge 1 commit into
kota65535 wants to merge 1 commit into
Conversation
cef8a4d to
d7cae0b
Compare
Signed-off-by: Tomohiko Ozawa <kota65535@gmail.com>
d7cae0b to
198d5ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49021
OrganizationScope.resolveClientScope()determines whether a client scope supports organizations by checking for the hardcodedoidc-organization-membership-mapperprovider ID.Custom protocol mappers that handle organization claims are not recognized, causing scope-based organization resolution to be silently skipped. This means the SSO propagation fixes (#35949, #43339) do not apply when a custom mapper replaces the built-in
OrganizationMembershipMapper.This PR introduces an
OrganizationAwareMappermarker interface that custom mappers can implement to declare organization support. The check inOrganizationScopeis changed from a provider ID string match to aninstanceofcheck, following the established pattern used byOIDCAccessTokenMapper,UserInfoTokenMapper, andSAMLAttributeStatementMapper.Changes
OrganizationAwareMappermarker interface inorg.keycloak.protocol.oidc.mappersOrganizationMembershipMapperimplementsOrganizationAwareMapper(backward compatible)OrganizationScope.resolveClientScope()usesinstanceof OrganizationAwareMapperinstead of hardcoded
OrganizationMembershipMapper.PROVIDER_IDAI-assisted development was used in this PR with Claude Code. All changes have been reviewed and are understood by the author.