- Notifications
You must be signed in to change notification settings - Fork928
fix: Prevent infinite redirects on oidc errors#6550
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -61,11 +61,18 @@ func ExtractOAuth2(config OAuth2Config, client *http.Client) func(http.Handler) | ||
// We should terminate the OIDC process if we encounter an error. | ||
oidcError := r.URL.Query().Get("error") | ||
errorDescription := r.URL.Query().Get("error_description") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Perthe OIDC spec only the Also there is an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I do handle an empty I can add | ||
errorURI := r.URL.Query().Get("error_uri") | ||
if oidcError != "" { | ||
// Combine the errors into a single string if either is provided. | ||
if errorDescription == "" && errorURI != "" { | ||
errorDescription = fmt.Sprintf("error_uri: %s", errorURI) | ||
} else if errorDescription != "" && errorURI != "" { | ||
errorDescription = fmt.Sprintf("%s, error_uri: %s", errorDescription, errorURI) | ||
} | ||
oidcError = fmt.Sprintf("Encountered error in oidc process: %s", oidcError) | ||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ | ||
Message: oidcError, | ||
//This message might be blank. Thisisok. | ||
Detail: errorDescription, | ||
}) | ||
return | ||