Login error after token expired
Description
After being logged out due to my token expiring, I get an error when I try to log in again.
Reproducible Steps
Steps to create the smallest reproducible scenario:
- Login
- Wait to be logout automatically
- Login again
- An error occured
@RomuDeuxfois Is this a problem with local authentication ? OpenId auth ? All ?
@guillaumejparis The problem was seen with the corporate login, testing platform.
Ok so SAML
This error ?
To test and fix this, we need to reproduce it in local with a low token timeout but I cannot do that as I don't have the rights on microsoft entra.
@guillaumejparis
I think the repro case is much more simpler:
- Login with SAML
- Restart the platform
- Reload
- Login again
I can't reproduce the issue, even in the staging environment.
Same I can't reproduce on local, I see it sometimes on testing.
So far we tried to restart the backend, destroy our jsessionid. I've already see it in local but at random times when of course I have no way to debug it. Sometimes it seems that it happens after some time when not interacting with obas but it is not systematic
I managed to find a way to reproduce the issue :
- Go to the login page
- Wait 5 min (maybe less, I haven't found the exact time)
- Try to log using SAML
I'm still investigating as to why this happens.
State of this bug : From what I understand, the issue is that the response from the SAML service provider contains a param "InResponseTo" that specify the ID of the request that initiated the authentication. On a working use case, spring is supposed to check that this ID is contained in a default spring repository. For unknown reasons, that ID is not found when waiting for 5 min between going to the login page and calling the service provider. I'm still working on this bug to find a fix.
Update on this issue :
First of all, the bug happens when hitting the 120s mark.
The issue is that the request is saved correctly before doing the call to the Service Provider but if the session is older than 120s, it is recreated during the callback from the Service Provider to the backend (step 6 on the schema linked to this comment) leading to an error during the validation of the initial request. I'm very much unsure why or who is the component that invalidates this session so I decided to fix the issue by recreating an HttpSession right before the initial call is made (step 3 in the schema), when we save the request and copying the attributes from the old one to the new one. This is not ideal but we spend way too much time on this and it fixes the issue.