Auth: Remove Email Lookup from oauth integrations (#894)

Remove email lookup from oauth integrations

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Jo
2023-06-23 09:08:02 +02:00
committed by Horst Gutmann
co-authored by ievaVasiljeva
parent 0dac2b7d08
commit b8a336c9d7
4 changed files with 67 additions and 15 deletions
+6 -1
View File
@@ -140,6 +140,11 @@ func (c *OAuth) Authenticate(ctx context.Context, r *authn.Request) (*authn.Iden
return userInfo.Role, userInfo.IsGrafanaAdmin, nil
})
lookupParams := login.UserLookupParams{}
if c.cfg.OAuthAllowInsecureEmailLookup {
lookupParams.Email = &userInfo.Email
}
return &authn.Identity{
Login: userInfo.Login,
Name: userInfo.Name,
@@ -158,7 +163,7 @@ func (c *OAuth) Authenticate(ctx context.Context, r *authn.Request) (*authn.Iden
AllowSignUp: c.connector.IsSignupAllowed(),
// skip org role flag is checked and handled in the connector. For now we can skip the hook if no roles are passed
SyncOrgRoles: len(orgRoles) > 0,
LookUpParams: login.UserLookupParams{Email: &userInfo.Email},
LookUpParams: lookupParams,
},
}, nil
}