Merge pull request #7781 from reasonerjt/respond-403-in-oidc-login

Update login controller to return 403 for redirection
This commit is contained in:
Daniel Jiang 2019-05-14 11:20:03 +08:00 committed by GitHub
commit cbcc28ed16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,11 @@ func (cc *CommonController) Login() {
}
url := strings.TrimSuffix(ep, "/") + common.OIDCLoginPath
log.Debugf("Redirect user %s to login page of OIDC provider", principal)
cc.Redirect(url, http.StatusFound)
// Return a json to UI with status code 403, as it cannot handle status 302
cc.Ctx.Output.Status = http.StatusForbidden
cc.Ctx.Output.JSON(struct {
Location string `json:"redirect_location"`
}{url}, false, false)
return
}