fix(openid-connect): handle temporarily_unavailable from IDP by restarting auth flow (#13776) - #13788
Open
waterWang wants to merge 1 commit into
Open
fix(openid-connect): handle temporarily_unavailable from IDP by restarting auth flow (#13776)#13788waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
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.
What does this PR do?
Fixes #13776. When an OAuth2 identity provider redirects back to APISIX's redirect_uri with a standard error response (per RFC 6749 §4.1.2.1), the openid-connect plugin currently falls through to a generic 500 error. This is particularly problematic for the
temporarily_unavailablecode, which can occur during entirely nominal operation — e.g. Keycloak's login session expiring before the user completes authentication.This PR detects
error=temporarily_unavailableon a GET callback and restarts the authentication flow (302 redirect back to the original URL) instead of dead-ending with a 500. Other error codes likeaccess_denied/login_requiredreflect a deliberate outcome and are intentionally NOT retried.Why is this needed?
temporarily_unavailableis a transient failure — the login attempt can be automatically retried without any user interaction. Returning a 500 on a recoverable condition is a bug.Verification
error=temporarily_unavailableon a GET callback → 302 redirect, flow restarts (recoverable)error=access_denied→ still 500 (deliberate outcome, not retried)PR Checklist
t/)