Repository navigation
Conversation
When the identity provider rejects the stored refresh token with invalid_grant, end only the local session instead of additionally sending a sign-out request that fails for the same reason. Other refresh errors keep their previous behavior. Related: fixes owncloud#376 (invalid_grant branch of session refresh) Signed-off-by: Hendrik Linka <[email protected]>
|
|
5 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the identity provider rejects the stored refresh token with
invalid_grant, the current code treats it like any other refresh failure: it logs the error, callslogout(), and throws.logout()additionally triggers theuser.afterlogouthook, which sends a sign-out request to the identity provider — one that fails for the same reason, because the refresh token is already invalid.This PR ends only the local session in that case:
user.afterlogoutlistener is kept on a property and removed beforelogout()runs, so the failing sign-out request is not sentClientExceptionwitherror=invalid_grant, and a decoded response body with anerrorpropertyHintExceptionthrownTests
testRejectedRefreshEndsLocalSession— forinvalid_grant(both the HTTP shape and the response-body shape, cached and fresh token) the session ends, the error is logged, aHintExceptionis thrown, and the sign-out request to the identity provider is not triggeredtestOtherRefreshFailuresRemainErrors— other HTTP errors (400 with a different error code, 500) and other response errors (access_denied,server_error) still log the error, trigger the sign-out request and throwBackground
Split out of #377 as requested in the review there: this PR contains only the
SessionVerifierchange for theinvalid_grantpath (related to #376) and no changes to the OAuth2 app. TheOpenIdConnectAuthModulepart of #377 is intentionally dropped here.