[v10.1.x] Auth: lock down Grafana admin sync for SAML (#72839)

Auth: lock down Grafana admin sync for SAML (#72828)

lock down Grafana admin sync for SAML

(cherry picked from commit 3a2538c2ca)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2023-08-03 19:14:08 +03:00
committed by GitHub
co-authored by Ieva
parent cb1c3bf2b3
commit 197682a43e
2 changed files with 6 additions and 2 deletions
+2
View File
@@ -125,6 +125,8 @@ func IsGrafanaAdminExternallySynced(cfg *setting.Cfg, authModule string, oAuthAn
switch authModule {
case JWTModule:
return cfg.JWTAuthAllowAssignGrafanaAdmin
case SAMLAuthModule:
return cfg.SAMLRoleValuesGrafanaAdmin != ""
case LDAPAuthModule:
return true
default:
+4 -2
View File
@@ -515,8 +515,9 @@ type Cfg struct {
SecureSocksDSProxy SecureSocksDSProxySettings
// SAML Auth
SAMLAuthEnabled bool
SAMLSkipOrgRoleSync bool
SAMLAuthEnabled bool
SAMLSkipOrgRoleSync bool
SAMLRoleValuesGrafanaAdmin string
// Okta OAuth
OktaAuthEnabled bool
@@ -1261,6 +1262,7 @@ func (cfg *Cfg) readSAMLConfig() {
samlSec := cfg.Raw.Section("auth.saml")
cfg.SAMLAuthEnabled = samlSec.Key("enabled").MustBool(false)
cfg.SAMLSkipOrgRoleSync = samlSec.Key("skip_org_role_sync").MustBool(false)
cfg.SAMLRoleValuesGrafanaAdmin = samlSec.Key("role_values_grafana_admin").MustString("")
}
func (cfg *Cfg) readLDAPConfig() {