SAML Flows for Logout
This chapter describes the supported flows for SAML logout based on our sample setup. The SAML logout flows are best-effort; successful execution cannot be guaranteed.
Be aware of the following limitations:
- SAML SPs must use the same endpoints for their assertionConsumerService and their singleLogoutService.
- This is the case if the SP is provided by Nevis, but can be problematic when integrating a third-party SP.
- Contact support if you want to integrate an SP that requires the use of different URLs for these two endpoints.
- There is no feedback to the user if the session was successfully terminated for all affected parties.
- This can be improved by adapting the Javascript that is included in the default nevisLogRend template (see macros.vm).
- The internal nevisProxy Login Renderer pattern cannot be used as it is not able to inject the Javascript required to distribute SAML messages.
- Use the nevisLogrend pattern instead if you want to support SAML logout flows.
IDP-Initiated SAML Logout
IDP-initiated SAML logout works as follows (the numbers of the steps below correspond with the numbers in the figure above):
- Logout is initiated by sending any HTTP request to a logout location of the SAML IDP. The SAML IDP provides two such locations:
<path>/logout
- logout with confirmation<path>/?logout
- logout without confirmation- Here
<path>
stands for any Frontend Path entered in the SAML IDP pattern.
- The SAML IDP responds as follows:
- The IdentityProviderState produces an AUTH_CONTINUE response that contains a GUI descriptor.
- nevisLogRend transforms the GUI descriptor into an HTML page.
- nevisLogRend adds some Javascript (see macros.vm), which takes care of the remainder of this flow.
- The browser sends a LogoutRequest message to each SP that has participated in this session.
- The requests are sent in parallel using AJAX calls.
- The LogoutRequest is included as a query parameter SAMLRequest.
- The SP terminates the session of the user.
- The SP clears any additional cookies used to detect expired sessions. See the Session Expiration features in the SAML SP Realm pattern.
- The SP returns a LogoutResponse. The default Javascript simply ignores these messages.
- Once all SPs have been informed, the user is sent to a logout URL.
- The default logout URL is the root location ( / ) of the virtual host that runs the SAML IDP.
- You can use the Logout pattern to change the logout URL.
SP-Initiated SAML Logout
SP-initiated SAML logout works as follows (the numbers of the steps below correspond with the numbers in the figure above):
- Logout is initiated by sending a request to an application URL with the query parameter logout.
- Example:
https://www.siven.ch/myapp/?logout
- The request is intercepted by nevisProxy and does not reach the application.
- The IDP is determined and the corresponding ServiceProviderState returns a LogoutRequest.
- Example:
- The browser is instructed to send a LogoutRequest to the SAML IDP.
- This request is typically sent using a POST request.
- The request is validated by the SAML IDP (IdentityProviderState).
- The SAML IDP answers as follows:
- The IdentityProviderState produces an AUTH_CONTINUE response which contains a GUI descriptor.
- nevisLogRend transforms the GUI descriptor into an HTML page.
- nevisLogRend adds some Javascript (see macros.vm), which takes care of the remaining flow.
- The browser sends a LogoutRequest message to each additional SP that has participated in this session.
- The requests are sent in parallel via AJAX calls.
- The LogoutRequest is added as a query parameter SAMLRequest.
- The SP terminates the session of the user.
- The SP clears any additional cookies used to detect expired sessions.
- The SP returns a LogoutResponse. The default Javascript just ignores these responses.
- The session is terminated at the IDP by sending an additional request with ?logout attached.
- This request is also sent in the background using an AJAX call.
- This is required to ensure that the session at the IDP is terminated.
- The user is sent to the SP that has initiated the SAML logout.
- The URL contains a LogoutResponse message to signal a successful logout.
- The SAML SP redirects the user to its logout target.
- By default the RelayState (URL of the application) is used and thus a new SAML authentication will be initiated.
- You can set a different Logout Target in the SAML SP Realm pattern.