3

When the SAML logout handler is called, how do I identify the user and what relevant sessions are being invalidated?

The LogoutHandler interface has: void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication);

Is the following something that can be assumed?

ExpiringUsernameAuthenticationToken auth = (ExpiringUsernameAuthenticationToken) authentication; SAMLCredential credentials = (SAMLCredential)auth.getCredentials(); String nameId = credentials.getNameID().getValue();

When NameId is transient, is it ok to assume that it stays the same within one particular session? I could not find concrete evidence from SAML documentation. I only know that it is not persistent across multiple sessions.

Should I actually use SessionIndex instead of NameId? Is it possible that Service Provider gets a logout request that has transient NameId with multiple SessionIndexes?

The actual problem: when user is authenticated, I need to create custom authentication token, and tie it in database to SAML SessionIndex/NameId (which ever is the proper one). When user logouts, I need to remove the corresponding custom token from the database using the same id that was used in login. How could I accomplish this with Spring SAML?

egaga
  • 21,042
  • 10
  • 46
  • 60
  • 1
    Did you get find any answer to this question later? Please consider posting it as an answer. I have the same question. Also, does the above code work? In my case, the authentication object was null. – Rushil Paul Mar 27 '18 at 14:08

0 Answers0