Auth: Remove Email Lookup from oauth integrations 9.5 (#895)

backport https://github.com/grafana/grafana-private-mirror/pull/894 to 9.5.x
This commit is contained in:
Ieva
2023-06-23 08:59:35 +02:00
committed by Horst Gutmann
parent dd7d0e8883
commit bef41a5cc9
4 changed files with 51 additions and 15 deletions
+9 -8
View File
@@ -339,16 +339,17 @@ func (hs *HTTPServer) SyncUser(
connect social.SocialConnector,
) (*user.User, error) {
oauthLogger.Debug("Syncing Grafana user with corresponding OAuth profile")
lookupParams := loginservice.UserLookupParams{}
if hs.Cfg.OAuthAllowInsecureEmailLookup {
lookupParams.Email = &extUser.Email
}
// add/update user in Grafana
cmd := &loginservice.UpsertUserCommand{
ReqContext: ctx,
ExternalUser: extUser,
SignupAllowed: connect.IsSignupAllowed(),
UserLookupParams: loginservice.UserLookupParams{
Email: &extUser.Email,
UserID: nil,
Login: nil,
},
ReqContext: ctx,
ExternalUser: extUser,
SignupAllowed: connect.IsSignupAllowed(),
UserLookupParams: lookupParams,
}
upsertedUser, err := hs.Login.UpsertUser(ctx.Req.Context(), cmd)