mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Auth Proxy: Log any error in middleware (#17275)
Fixes so that errors happening in auth proxy middleware is logged. Ref #17247
This commit is contained in:
parent
1a2841e244
commit
b9181df212
@ -31,6 +31,7 @@ func initContextWithAuthProxy(store *remotecache.RemoteCache, ctx *m.ReqContext,
|
|||||||
|
|
||||||
// Check if allowed to continue with this IP
|
// Check if allowed to continue with this IP
|
||||||
if result, err := auth.IsAllowedIP(); !result {
|
if result, err := auth.IsAllowedIP(); !result {
|
||||||
|
ctx.Logger.Error("auth proxy: failed to check whitelisted ip addresses", "message", err.Error(), "error", err.DetailsError)
|
||||||
ctx.Handle(407, err.Error(), err.DetailsError)
|
ctx.Handle(407, err.Error(), err.DetailsError)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -38,6 +39,7 @@ func initContextWithAuthProxy(store *remotecache.RemoteCache, ctx *m.ReqContext,
|
|||||||
// Try to log in user from various providers
|
// Try to log in user from various providers
|
||||||
id, err := auth.Login()
|
id, err := auth.Login()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
ctx.Logger.Error("auth proxy: failed to login", "message", err.Error(), "error", err.DetailsError)
|
||||||
ctx.Handle(500, err.Error(), err.DetailsError)
|
ctx.Handle(500, err.Error(), err.DetailsError)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -45,6 +47,7 @@ func initContextWithAuthProxy(store *remotecache.RemoteCache, ctx *m.ReqContext,
|
|||||||
// Get full user info
|
// Get full user info
|
||||||
user, err := auth.GetSignedUser(id)
|
user, err := auth.GetSignedUser(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
ctx.Logger.Error("auth proxy: failed to get signed in user", "message", err.Error(), "error", err.DetailsError)
|
||||||
ctx.Handle(500, err.Error(), err.DetailsError)
|
ctx.Handle(500, err.Error(), err.DetailsError)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -55,6 +58,7 @@ func initContextWithAuthProxy(store *remotecache.RemoteCache, ctx *m.ReqContext,
|
|||||||
|
|
||||||
// Remember user data it in cache
|
// Remember user data it in cache
|
||||||
if err := auth.Remember(id); err != nil {
|
if err := auth.Remember(id); err != nil {
|
||||||
|
ctx.Logger.Error("auth proxy: failed to store user in cache", "message", err.Error(), "error", err.DetailsError)
|
||||||
ctx.Handle(500, err.Error(), err.DetailsError)
|
ctx.Handle(500, err.Error(), err.DetailsError)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user