-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Fix OAuth2 Client with Ditributed Session #6215
Comments
@wangzw I'm having trouble understanding what the exact issue is. Can you provide a complete sample? |
Distributed session implementation such as redis and hazelcast, only update the modified part of session data to session storage. And the session modification is captured by calling For example: The following code will NOT add ("key", "value") to session key
You have to add
For the above reason, we finally got "authorization_request_not_found" in some case since the code failed to update session's data. |
Thanks I re-read the issue and understand the problem. Would you be interested in putting a PR together? |
#6109 is filed for this issue. |
I got the following error message and after the whole day debug, I found that oauth2 client failed to save
AuthorizationRequest
to session in some case.To trigger the issue, you have to:
AuthorizationRequest
leaved in the sessionResult:
Oauth2 client will continue failing with error
authorization_request_not_found
Root cause:
in ReactiveRedisOperationsSessionRepository.java
Only the delta data
session.saveDelta()
will be update in redis session.And the delta is captured by
WebSession::getAttributes::setAttribute
But In WebSessionOAuth2ServerAuthorizationRequestRepository.java
It get state to AuthorizationRequest map from session's attribute and update its value, And does not put the map back to session's attribute again by calling
setAttribute
. So redis session will not capture such change and fail to update the modification.And then
authorization_request_not_found
will be raised sinceAuthorizationRequest
is not in session.The text was updated successfully, but these errors were encountered: