parent
a36c1eaac1
commit
68e62fc98a
@ -0,0 +1,61 @@
|
|||||||
|
commit bae86dbeb0
|
||||||
|
Author: Ieva <ieva.vasiljeva@grafana.com>
|
||||||
|
Date: Tue Jun 6 17:45:31 2023 +0100
|
||||||
|
|
||||||
|
Auth: Remove Email Lookup from oauth integrations 9.2 (#898)
|
||||||
|
|
||||||
|
backport https://github.com/grafana/grafana-private-mirror/pull/894 to 9.3.x
|
||||||
|
|
||||||
|
diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go
|
||||||
|
index 22014aee43..af00c56a68 100644
|
||||||
|
--- a/pkg/api/login_oauth.go
|
||||||
|
+++ b/pkg/api/login_oauth.go
|
||||||
|
@@ -299,16 +299,17 @@
|
||||||
|
connect social.SocialConnector,
|
||||||
|
) (*models.User, error) {
|
||||||
|
oauthLogger.Debug("Syncing Grafana user with corresponding OAuth profile")
|
||||||
|
+ lookupParams := models.UserLookupParams{}
|
||||||
|
+ if hs.Cfg.OAuthAllowInsecureEmailLookup {
|
||||||
|
+ lookupParams.Email = &extUser.Email
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// add/update user in Grafana
|
||||||
|
cmd := &models.UpsertUserCommand{
|
||||||
|
- ReqContext: ctx,
|
||||||
|
- ExternalUser: extUser,
|
||||||
|
- SignupAllowed: connect.IsSignupAllowed(),
|
||||||
|
- UserLookupParams: models.UserLookupParams{
|
||||||
|
- Email: &extUser.Email,
|
||||||
|
- UserID: nil,
|
||||||
|
- Login: nil,
|
||||||
|
- },
|
||||||
|
+ ReqContext: ctx,
|
||||||
|
+ ExternalUser: extUser,
|
||||||
|
+ SignupAllowed: connect.IsSignupAllowed(),
|
||||||
|
+ UserLookupParams: lookupParams,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := hs.Login.UpsertUser(ctx.Req.Context(), cmd); err != nil {
|
||||||
|
diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go
|
||||||
|
index 20e8f78a2f..03aa5c17d8 100644
|
||||||
|
--- a/pkg/setting/setting.go
|
||||||
|
+++ b/pkg/setting/setting.go
|
||||||
|
@@ -312,7 +312,8 @@
|
||||||
|
AuthProxySyncTTL int
|
||||||
|
|
||||||
|
// OAuth
|
||||||
|
- OAuthCookieMaxAge int
|
||||||
|
+ OAuthCookieMaxAge int
|
||||||
|
+ OAuthAllowInsecureEmailLookup bool
|
||||||
|
|
||||||
|
// JWT Auth
|
||||||
|
JWTAuthEnabled bool
|
||||||
|
@@ -1256,6 +1256,8 @@
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
+ cfg.OAuthAllowInsecureEmailLookup = auth.Key("oauth_allow_insecure_email_lookup").MustBool(false)
|
||||||
|
+
|
||||||
|
const defaultMaxLifetime = "30d"
|
||||||
|
maxLifetimeDurationVal := valueAsString(auth, "login_maximum_lifetime_duration", defaultMaxLifetime)
|
||||||
|
cfg.LoginMaxLifetime, err = gtime.ParseDuration(maxLifetimeDurationVal)
|
@ -0,0 +1,19 @@
|
|||||||
|
From 3236aa416f6d1b109bff1fdd4127292988fb199c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stan Cox <scox@redhat.com>
|
||||||
|
Date: Wed, 22 Jun 2022 17:05:48 +0200
|
||||||
|
Subject: [PATCH] fix alert test
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/pkg/tests/api/alerting/api_alertmanager_test.go b/pkg/tests/api/alerting/api_alertmanager_test.go
|
||||||
|
index 2d6e1235b6..f0eff6d2ac 100644
|
||||||
|
--- a/pkg/tests/api/alerting/api_alertmanager_test.go 2023-01-24 14:44:19.000000000 -0500
|
||||||
|
+++ b/pkg/tests/api/alerting/api_alertmanager_test.go 2023-04-13 16:20:51.718515009 -0400
|
||||||
|
@@ -210,7 +210,7 @@
|
||||||
|
{
|
||||||
|
"comment": "string",
|
||||||
|
"createdBy": "string",
|
||||||
|
- "endsAt": "2023-03-31T14:17:04.419Z",
|
||||||
|
+ "endsAt": "2032-03-31T14:17:04.419Z",
|
||||||
|
"matchers": [
|
||||||
|
{
|
||||||
|
"isRegex": true,
|
Loading…
Reference in new issue