Skip to content

Commit 59eb2f6

Browse files
AuthN: Lock down manual role updates for users synced through Grafana Com portal (grafana#72044)
take into account auth.grafananet config section when checking if gcom auth is enabled
1 parent 12f7524 commit 59eb2f6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/services/login/authinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func IsProviderEnabled(cfg *setting.Cfg, authModule string) bool {
133133
case GithubAuthModule:
134134
return cfg.GitHubAuthEnabled
135135
case GrafanaComAuthModule:
136-
return cfg.GrafanaComAuthEnabled
136+
return cfg.GrafanaComAuthEnabled || cfg.GrafanaNetAuthEnabled
137137
case GenericOAuthModule:
138138
return cfg.GenericOAuthAuthEnabled
139139
}

pkg/setting/setting.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,9 @@ type Cfg struct {
494494
// skip the org roles coming from GrafanaCom
495495
GrafanaComSkipOrgRoleSync bool
496496

497+
// Grafana.com Auth enabled through [auth.grafananet] config section
498+
GrafanaNetAuthEnabled bool
499+
497500
// Geomap base layer config
498501
GeomapDefaultBaseLayerConfig map[string]interface{}
499502
GeomapEnableCustomBaseLayers bool
@@ -1452,6 +1455,11 @@ func readAuthGrafanaComSettings(cfg *Cfg) {
14521455
cfg.GrafanaComSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
14531456
}
14541457

1458+
func readAuthGrafanaNetSettings(cfg *Cfg) {
1459+
sec := cfg.SectionWithEnvOverrides("auth.grafananet")
1460+
cfg.GrafanaNetAuthEnabled = sec.Key("enabled").MustBool(false)
1461+
}
1462+
14551463
func readAuthGithubSettings(cfg *Cfg) {
14561464
sec := cfg.SectionWithEnvOverrides("auth.github")
14571465
cfg.GitHubAuthEnabled = sec.Key("enabled").MustBool(false)
@@ -1559,6 +1567,7 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
15591567

15601568
// GrafanaCom
15611569
readAuthGrafanaComSettings(cfg)
1570+
readAuthGrafanaNetSettings(cfg)
15621571

15631572
// Github
15641573
readAuthGithubSettings(cfg)

0 commit comments

Comments
 (0)