Skip to content

Make SAML Single Logout work with custom principal #10820

@chschu

Description

@chschu

Expected Behavior

SAML Single Logout should work even if the principal does not implement the Saml2AuthenticatedPrincipal interface.

Current Behavior

The following parts of SAML Single Logout only work as expected if the principal implements Saml2AuthenticatedPrincipal:

  • Populating the NameID in OpenSamlLogoutRequestResolver
    • expects Authentication.getName() to return the NameID value from the SAML Assertion
  • Populating the SessionIndex list in OpenSamlLogoutRequestResolver
    • expects the principal to implement Saml2AuthenticatedPrincipal
  • Extracting the RelyingPartyRegistrationId from the Authentication in OpenSamlLogoutRequestResolver, OpenSamlLogoutResponseResolver and Saml2LogoutRequestFilter
    • expects the principal to implement Saml2AuthenticatedPrincipal
    • if it does not, the RelyingPartyRegistrationId must be in the request URL, at least when using DefaultRelyingPartyRegistrationResolver
    • there is some duplicate code in these three classes
  • Request matching for LogoutFilter in Saml2LogoutConfigurer.Saml2RequestMatcher
    • expects the principal to implement Saml2AuthenticatedPrincipal

All these don't work if the responseAuthenticationConverter in OpenSaml(4)AuthenticationProvider is customized and the principal does not implement Saml2AuthenticatedPrincipal.

It would be great if SAML Single Logout could be configured to work with any principal. This could be achieved using yet another resolver interface - passing HttpServletRequest and Authentication as parameters should be sufficient. The implementations of this resolver interface could then be made to match the responseAuthenticationConverter.

Context

In some cases, this issue can be solved by making the principal implement Saml2AuthenticatedPrincipal. Unfortunately, this does not work in my specific case, because the principal is created and used in code that doesn't use Spring Security.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions