Skip to content

Add RelayState-based Authentication Request Respository #14793

Closed
@shardasud16

Description

@shardasud16

Describe the bug
We have a business use case where an application opens multiple tabs of our application, and they share the same session ID. When an HTTP session times out and a new request is sent, all tabs send parallel requests. Based on my understanding so far, HttpSessionSaml2AuthenticationRequestRepository saves the Saml2AuthenticationRequest in the HttpSession using a static key per session. In our case, if six requests are sent in parallel, it overwrites the request. When the SSO response is received, say for the first request, the InResponseTo validation fails as the session has a different Saml2AuthenticationRequest with a different ID. I have very limited experience with Spring Security before this, thus my understanding might be limited.

To Reproduce

Open multiple tabs of an app which has SSO SAML2 authentication (open-saml-4.2.0).
Set HTTP Session to 1 minute.
Once all tabs' sessions expire, click on "your session has expired," click all one after the other.
The same session gets shared between multiple tabs, and the request is stored in the session.
When a response comes from the first request, the session might have request 2 stored, and in this case, InResponseTo validation fails.
Expected behavior
HttpSessionSaml2AuthenticationRequestRepository should store the Saml2AuthenticationRequest within the session with a unique ID added to the key like "RelayState":

private static final String DEFAULT_SAML2_AUTHN_REQUEST_ATTR_NAME = HttpSessionSaml2AuthenticationRequestRepository.class.getName().concat(".SAML2_AUTHN_REQUEST");

My knowledge is limited here and might be missing some key understanding. If you can redirect me to the correct usage, it would be helpful, as I can't find any thread for this similar issue anywhere. We can use some existing solutions like storing requests in our Hazelcast cluster and loading it for authentication, but before this, I want to understand if there is any issue with the current implementation.implementation

Spring Version: 6.2.1
open-saml- 4.2
SAML2.0
JAVA 17
Tomcat 10.1.8

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions