-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-authenticate users if the OIDC session cookie can not be read #46822
Re-authenticate users if the OIDC session cookie can not be read #46822
Conversation
// Make this error message visible in the dev mode | ||
return Uni.createFrom().failure(new AuthenticationFailedException(error)); | ||
} catch (NumberFormatException ex) { | ||
final String error = "Access token expires_in property in the session cookie must be a number"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we had the value that was found, for debugging purposes
final String error = "Access token expires_in property in the session cookie must be a number"; | |
final String error = "Access token expires_in property in the session cookie must be a number, found %s"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gastaldi Sure, took me a little while to experiment with getting to that value from different branches, so I wrapped the actual parsing call in a function to make it easier, hope it looks better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but I wonder if we can improve that error message with some useful data
This comment has been minimized.
This comment has been minimized.
d5bc3a5
to
3b248a5
Compare
Status for workflow
|
Fixes #46765.
The internal session cookie format changed in 3.18, which, given it is not part of the API, should not have caused any issues. However, in advanced OIDC applications, what happens, as explained by @sschellh, is that there could be a large number of currently logged in users possibly in different regions, which have not had time to logout before the new Quarkus release is deployed. thus keeping the existing session cookies.
For example, a user logged in the morning, the session is active for 8 hours, new Quarkus is deployed at lunch time, and the user can not access the application after lunch.
In such cases, if the internal session format changes, currently, Quarkus, after failing to parse the cookie content, stops users in their tracks with
401
which is not a good user experience.Instead, Quarkus should remove the session cookie it can not parse and request re-authentication - the user may not even notice if the OIDC provider's own session cookies still valid.
This is what this simple PR does - deletes the session cookie (this is already done on main and tested) but instead of terminating the flow with 401, it forces the re-authentication with 302.