-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
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
NameIDinOpenSamlLogoutRequestResolver- expects
Authentication.getName()to return theNameIDvalue from the SAML Assertion
- expects
- Populating the
SessionIndexlist inOpenSamlLogoutRequestResolver- expects the principal to implement
Saml2AuthenticatedPrincipal
- expects the principal to implement
- Extracting the
RelyingPartyRegistrationIdfrom theAuthenticationinOpenSamlLogoutRequestResolver,OpenSamlLogoutResponseResolverandSaml2LogoutRequestFilter- expects the principal to implement
Saml2AuthenticatedPrincipal - if it does not, the
RelyingPartyRegistrationIdmust be in the request URL, at least when usingDefaultRelyingPartyRegistrationResolver - there is some duplicate code in these three classes
- expects the principal to implement
- Request matching for
LogoutFilterinSaml2LogoutConfigurer.Saml2RequestMatcher- expects the principal to implement
Saml2AuthenticatedPrincipal
- expects the principal to implement
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.