A logout request can be sent when the user has identified themselves and personal data has been retrieved from the token endpoint. Logging out takes place according to the OpenID specification, the documentation of which can be found here.
Logging out can take place in two directions:
Initiated by the e-service: Here, the e-service directs the user’s browser to the end-session endpoint, and after a successful logout, the user is directed back to the e-service.
Initiated by Suomi.fi e-Identification: If the user has simultaneous active sessions in several e-services (Single Sign-On, SSO), Suomi.fi e-Identification will also notify the logout to the other e-services with a session. In this case, the call is made to the e-service’s frontchannel_logout_uri, which has been specified in the e-service metadata.
Prerequisite: The e-service has saved the identifier of the identification event received in connection with the identification performed by the user (session id, see claims under id_token on the page Token request and response). This is required when a logout request is generated and when a logout request of Suomi.fi e-Identification is processed in the case of single logouts (SLO).
Below is an example of a logout request sent to Suomi.fi e-Identification.
The identifier of the identification event (session id)
Things to consider
The logout_hint parameter must be used in logout requests, and the value given to it is the identifier of the user identification event (session id).
The id_token_hint parameter is not used because id_tokens have been encrypted with the public key of the e-service (RP), and their content is not available to Suomi.fi e-Identification in connection with processing logouts.
In other words, the session is identified on the basis of the sid value, not on the basis of the id_token.
The logout response is sent to the post_logout_redirect_uri specified in the logout request.
Safety perspective
The post_logout_redirect_uri must be pre-registered in the e-service metadata. Suomi.fi e-Identification does not direct the logout response to any other addresses.
In this interface, logout requests do not have a CSRF security mechanism corresponding to the state parameter. For this reason, when processing the post_logout_redirect_uri, the e-service must not, merely on the basis of the redirection, perform any actions that would change the state. It can only show the confirmation of the logout to the user.
The e-service’s local session (such as the application’s own session cookies) must be invalidated before the user is directed to the end-session endpoint of Suomi.fi e-Identification. This ensures that the local session will not remain valid in the event of a possible error.
In single logouts, Suomi.fi e-Identification sends the logout response to the address specified for single sing-ons (frontchannel_logout_uri) in the e-service metadata:
Below is an example of a logout request sent by Suomi.fi e-Identification.
The identifier of the identification event (session id)
Processing a logout request of Suomi.fi e-Identification
A single logout request (front-channel logout) is received in the e-service's address for logout requests in single logouts. It is transmitted through the browser, in a hidden iframe element. The following matters must therefore be taken into account in the processing of the call:
The session to be invalidated is identified by the e-service on the basis of the sid parameter (not on the basis of cookies or some other session identifier because the transmission of cookies in the iframe context depends on the browser settings).
Before invalidating the session, the e-service must verify that the value of the iss parameter corresponds to the expected identifier of Suomi.fi e-Identification.
The endpoint must respond quickly and return a simple HTTP200 response after the successful invalidation. The user is not directed anywhere in connection with this call because the call takes place invisibly in the iframe element.
If no active session is found with the sid value (for example, the session has already expired), the endpoint must still return HTTP 200 instead of an error.
A single log-out request must not be responded to with redirection or any other function visible to the user because the call takes place in a hidden iframe element and the user cannot see the response