8000 Invalidate all matching SAML adapter sessions on logout by abstractj · Pull Request #55521 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Invalidate all matching SAML adapter sessions on logout - #55521

Open
abstractj wants to merge 1 commit into
keycloak:mainfrom
abstractj:issue-55284
Open

abstractj wants to merge 1 commit into
keycloak:mainfrom
abstractj:issue-55284

Conversation

@abstractj
Copy link
Copy Markdown
Contributor

Closes #55263

AI Disclosure: This commit was authored with the assistance of an AI coding tool. All changes were reviewed and approved by the committer.

Closes keycloak#55263

AI Disclosure: This commit was authored with the assistance of an AI
coding tool. All changes were reviewed and approved by the committer.

Signed-off-by: Bruno Oliveira da Silva <bruno@abstractj.com>
@abstractj
abstractj requested review from a team as code owners November 25, 2026 10:47
Copilot AI balanced review requested due to automatic review settings November 25, 2026 10:47
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The upgrade-note fragment is not included in the published upgrading guide, leaving users without mandatory custom-mapper rebuild instructions.

1 open issue
What changed in this PR

This PR addresses #55263 by updating SAML adapter logout to invalidate all local sessions sharing a session index and preserve the asserted NameID independently of the configured principal name.

Changes:

  • Extend the session-mapper SPI to return all matching sessions and update Elytron logout and cleanup.
  • Preserve the original SAML subject when using attribute-based principal names.
  • Add regression tests and migration guidance for custom session mappers.
File Description
testsuite/​integration-arquillian/​tests/​base/​src/​test/​java/​org/​keycloak/​testsuite/​adapter/​servlet/​SAMLLogoutAdapterTest.java Tests shared-index logout and NameID logout with attribute principals.
docs/​documentation/​upgrading/​topics/​changes/​changes-next-saml-session-id-mapper.adoc Adds SPI migration and existing-session guidance.
adapters/​spi/​adapter-spi/​src/​test/​java/​org/​keycloak/​adapters/​spi/​InMemorySessionIdMapperTest.java Tests multiple mappings, removal, snapshots, and remapping.
adapters/​spi/​adapter-spi/​src/​main/​java/​org/​keycloak/​adapters/​spi/​SessionIdMapper.java Adds multi-session lookup and deprecates single-session lookup.
adapters/​spi/​adapter-spi/​src/​main/​java/​org/​keycloak/​adapters/​spi/​InMemorySessionIdMapper.java Stores multiple sessions per index with synchronized access.
adapters/​saml/​wildfly-elytron/​src/​test/​java/​org/​keycloak/​adapters/​saml/​elytron/​ElytronSamlSessionStoreTest.java Tests logout of all matching sessions without duplicates.
adapters/​saml/​wildfly-elytron/​src/​main/​java/​org/​keycloak/​adapters/​saml/​elytron/​IdMapperUpdaterSessionListener.java Removes mappings even when no session index exists.
adapters/​saml/​wildfly-elytron/​src/​main/​java/​org/​keycloak/​adapters/​saml/​elytron/​ElytronSamlSessionStore.java Logs out all matching sessions and handles missing session scopes.
adapters/​saml/​core/​src/​main/​java/​o 8000 rg/​keycloak/​adapters/​saml/​profile/​AbstractSamlAuthenticationHandler.java Separates the asserted SAML subject from the principal display name.

Review effort: Balanced


=== SAML adapter session mapper

Custom implementations of `org.keycloak.adapters.spi.SessionIdMapper` must implement `getSessionsFromSSO(String)` and be rebuilt before upgrading the adapter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAML adapter session mapper fails to terminate all sessions on logout

2 participants

0