Skip to content

Allow custom protocol mappers to be recognized as organization-aware in OrganizationScope#49025

Open
kota65535 wants to merge 1 commit into
keycloak:mainfrom
kota65535:vk/2cb5-sso-kc-org-note
Open

Allow custom protocol mappers to be recognized as organization-aware in OrganizationScope#49025
kota65535 wants to merge 1 commit into
keycloak:mainfrom
kota65535:vk/2cb5-sso-kc-org-note

Conversation

@kota65535
Copy link
Copy Markdown
Contributor

@kota65535 kota65535 commented May 15, 2026

Closes #49021

OrganizationScope.resolveClientScope() determines whether a client scope supports organizations by checking for the hardcoded oidc-organization-membership-mapper provider 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 OrganizationAwareMapper marker interface that custom mappers can implement to declare organization support. The check in OrganizationScope is changed from a provider ID string match to an instanceof check, following the established pattern used by OIDCAccessTokenMapper, UserInfoTokenMapper, and SAMLAttributeStatementMapper.

Changes

  • Add OrganizationAwareMapper marker interface in org.keycloak.protocol.oidc.mappers
  • OrganizationMembershipMapper implements OrganizationAwareMapper (backward compatible)
  • OrganizationScope.resolveClientScope() uses instanceof OrganizationAwareMapper
    instead of hardcoded OrganizationMembershipMapper.PROVIDER_ID

AI-assisted development was used in this PR with Claude Code. All changes have been reviewed and are understood by the author.

@kota65535 kota65535 force-pushed the vk/2cb5-sso-kc-org-note branch from cef8a4d to d7cae0b Compare May 15, 2026 14:45
Signed-off-by: Tomohiko Ozawa <kota65535@gmail.com>
@kota65535 kota65535 force-pushed the vk/2cb5-sso-kc-org-note branch from d7cae0b to 198d5ad Compare May 15, 2026 15:51
@kota65535 kota65535 marked this pull request as ready for review May 15, 2026 16:50
@kota65535 kota65535 requested a review from a team as a code owner May 15, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom protocol mappers to be recognized as organization-aware in OrganizationScope

1 participant