Skip to content

SAML adapter session mapper fails to terminate all sessions on logout #55263

Description

@graziang

Describe the bug

An identity-provider-initiated SAML single logout can leave a local application
session active when using the WildFly/Elytron SAML adapter. Two independent gaps
cause this:

  • Shared SessionIndex: the adapter's session mapper keeps a single
    application session per IdP SessionIndex. That index is stable per user
    session and client, so when the same user establishes a second local session
    against the same application, the new mapping replaces the previous one. A
    LogoutRequest carrying that SessionIndex then terminates only the most
    recently mapped session, while the earlier one keeps its SAML attachment and
    stays authenticated.
  • Principal name mapping: when the deployment uses the FROM_ATTRIBUTE
    principal name policy, the value of the mapped attribute (for example the
    user's email) is stored both as the display name and as the SAML subject of
    the authenticated principal, discarding the original NameID. The session is
    therefore indexed under the attribute value, whereas a LogoutRequest without
    a SessionIndex is resolved by NameID. When the two values differ, no
    session matches.

In both cases the identity provider treats the user as logged out and receives a
successful LogoutResponse, while the application session remains usable.

Version

Present on main and on the 26.8 and 26.6 release branches.

Expected behavior

A LogoutRequest from the identity provider terminates every local session it
covers. All application sessions sharing a SessionIndex are terminated when
that index is logged out, and a LogoutRequest without a SessionIndex
resolves sessions by the subject asserted by the identity provider, regardless
of which attribute the deployment uses for the principal name.

Actual behavior

When several local sessions share one SessionIndex, only the most recently
created one is terminated. With FROM_ATTRIBUTE principal mapping and an
attribute value that differs from the NameID, a LogoutRequest without a
SessionIndex matches no session and terminates nothing. The surviving sessions
remain authenticated and the identity provider is told the logout succeeded.

Anything else?

The affected code is in the WildFly/Elytron SAML adapter and in the adapter
session-mapper SPI. Terminating all sessions that share a SessionIndex
requires the SPI to return every session mapped to an SSO identifier rather than
a single one, which changes a public SPI contract and affects external
implementations of that mapper.


This issue was originally tracked in the private repository. Migrated by @graziang.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for weakness.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions