Oauth: Display friendly error message when role_attribute_strict=true and no valid role found (#57818)

* Oauth: change error type to a struct that unwraps into a social error

* Oauth: Handle empty role in error and fix unwrap

* Oauth: provide more informatio in error

* Oauth: return InvalidBasicRoleError

* Oauth: Fix tests

* Login: Remove casing

* Oath: Change to warning logs
This commit is contained in:
Karl Persson
2022-10-31 09:11:31 +01:00
committed by GitHub
parent 89d917b196
commit 052d1426f9
8 changed files with 33 additions and 12 deletions
+1 -1
View File
@@ -353,7 +353,7 @@ func (hs *HTTPServer) trySetEncryptedCookie(ctx *models.ReqContext, cookieName s
}
func (hs *HTTPServer) redirectWithError(ctx *models.ReqContext, err error, v ...interface{}) {
ctx.Logger.Error(err.Error(), v...)
ctx.Logger.Warn(err.Error(), v...)
if err := hs.trySetEncryptedCookie(ctx, loginErrorCookieName, getLoginExternalError(err), 60); err != nil {
hs.log.Error("Failed to set encrypted cookie", "err", err)
}