mirror of
https://github.com/goharbor/harbor
synced 2025-05-21 09:51:25 +00:00
Merge pull request #8907 from airadier/handle-error-on-oidc-callback
Handle error on OIDC callback
This commit is contained in:
commit
1a57f67413
@ -83,6 +83,15 @@ func (oc *OIDCController) Callback() {
|
||||
oc.SendBadRequestError(errors.New("State mismatch"))
|
||||
return
|
||||
}
|
||||
|
||||
errorCode := oc.Ctx.Request.URL.Query().Get("error")
|
||||
if errorCode != "" {
|
||||
errorDescription := oc.Ctx.Request.URL.Query().Get("error_description")
|
||||
log.Errorf("OIDC callback returned error: %s - %s", errorCode, errorDescription)
|
||||
oc.SendBadRequestError(errors.Errorf("OIDC callback returned error: %s - %s", errorCode, errorDescription))
|
||||
return
|
||||
}
|
||||
|
||||
code := oc.Ctx.Request.URL.Query().Get("code")
|
||||
ctx := oc.Ctx.Request.Context()
|
||||
token, err := oidc.ExchangeToken(ctx, code)
|
||||
|
Loading…
x
Reference in New Issue
Block a user