Description
Summary
The HttpSessionSaml2AuthenticationRequestRepository
saves the Saml2AuthenticationRequest
in the session and tries to load it after the IdP authenticated the user.
This does not work when using Spring Session because the session cookie is not sent to the server after the IdP authenticated the user.
Spring Session creates a session cookie with SameSite=Lax
which causes the browser not to send the cookie when sending the POST
request after the IdP authentication.
To Reproduce
Create a minimal Spring Boot application with Spring Security SAML and Spring Session active.
Expected behaviour
After login at the IdP and being redirected to the application the user should be signed in and seeing the secured URL.
Actual behaviour
A new session is created and the user is at the login page again. When he tries to load the secured URL he is able to request it.