mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 15:35:43 +00:00
Merge pull request #8949 from reasonerjt/oidc-err-1.8
Handle error on OIDC callback -- cherry-pick to 1.8 branch
This commit is contained in:
commit
98bf819ca7
|
@ -82,6 +82,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…
Reference in New Issue
Block a user