Auth: Add skip_org_role_sync setting to OAuth integration Google (#61572)

* WIP

* Add: skip_org_role_sync for Google OAuth

- add setting for frontend
- add read of config
- add config to sample and default

* add: docs

* spelling

* Update pkg/login/social/social.go

* Apply suggestions from code review

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* removed unnessecary line

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
Eric Leijonmarck
2023-01-19 09:54:22 +01:00
committed by GitHub
co-authored by Christopher Moyer
parent 50df85189c
commit 0d42edddbf
8 changed files with 42 additions and 2 deletions
+11
View File
@@ -427,6 +427,9 @@ type Cfg struct {
// AzureAD
AzureADSkipOrgRoleSync bool
// Google
GoogleSkipOrgRoleSync bool
// LDAP
LDAPEnabled bool
LDAPSkipOrgRoleSync bool
@@ -1369,6 +1372,11 @@ func readAuthGrafanaComSettings(iniFile *ini.File, cfg *Cfg) {
cfg.GrafanaComSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
}
func readAuthGoogleSettings(iniFile *ini.File, cfg *Cfg) {
sec := iniFile.Section("auth.google")
cfg.GoogleSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
}
func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
auth := iniFile.Section("auth")
@@ -1417,6 +1425,9 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
cfg.AzureAuthEnabled = AzureAuthEnabled
readAuthAzureADSettings(iniFile, cfg)
// Google Auth
readAuthGoogleSettings(iniFile, cfg)
// anonymous access
AnonymousEnabled = iniFile.Section("auth.anonymous").Key("enabled").MustBool(false)
cfg.AnonymousEnabled = AnonymousEnabled