mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 04:01:49 +08:00
Auth: id response header (#77871)
* Add config options for identity id response header * Add feature to add identity id response header to all responses * Use util.SplitString
This commit is contained in:
@ -285,6 +285,9 @@ type Cfg struct {
|
||||
AdminEmail string
|
||||
DisableLoginForm bool
|
||||
SignoutRedirectUrl string
|
||||
IDResponseHeaderEnabled bool
|
||||
IDResponseHeaderPrefix string
|
||||
IDResponseHeaderNamespaces map[string]struct{}
|
||||
// Not documented & not supported
|
||||
// stand in until a more complete solution is implemented
|
||||
AuthConfigUIAdminAccess bool
|
||||
@ -1607,6 +1610,17 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
|
||||
// Azure Auth
|
||||
AzureAuthEnabled = auth.Key("azure_auth_enabled").MustBool(false)
|
||||
cfg.AzureAuthEnabled = AzureAuthEnabled
|
||||
|
||||
// ID response header
|
||||
cfg.IDResponseHeaderEnabled = auth.Key("id_response_header_enabled").MustBool(false)
|
||||
cfg.IDResponseHeaderPrefix = auth.Key("id_response_header_prefix").MustString("X-Grafana-")
|
||||
|
||||
idHeaderNamespaces := util.SplitString(auth.Key("id_response_header_namespaces").MustString(""))
|
||||
cfg.IDResponseHeaderNamespaces = make(map[string]struct{}, len(idHeaderNamespaces))
|
||||
for _, namespace := range idHeaderNamespaces {
|
||||
cfg.IDResponseHeaderNamespaces[namespace] = struct{}{}
|
||||
}
|
||||
|
||||
readAuthAzureADSettings(cfg)
|
||||
|
||||
// Google Auth
|
||||
|
Reference in New Issue
Block a user