Auth: add name parameter to auth.saml (#39883)

* add name parameter to auth.saml

* Create constant to store default SAML name
This commit is contained in:
Guilherme Caulada
2021-10-04 09:58:16 -03:00
committed by GitHub
parent 5219c72a6c
commit 706a665240
4 changed files with 9 additions and 2 deletions
+5
View File
@@ -97,6 +97,7 @@ func (hs *HTTPServer) LoginView(c *models.ReqContext) {
viewData.Settings["oauth"] = enabledOAuths
viewData.Settings["samlEnabled"] = hs.samlEnabled()
viewData.Settings["samlName"] = hs.samlName()
if loginError, ok := hs.tryGetEncryptedCookie(c, loginErrorCookieName); ok {
// this cookie is only set whenever an OAuth login fails
@@ -346,6 +347,10 @@ func (hs *HTTPServer) samlEnabled() bool {
return hs.SettingsProvider.KeyValue("auth.saml", "enabled").MustBool(false) && hs.License.HasValidLicense()
}
func (hs *HTTPServer) samlName() string {
return hs.SettingsProvider.KeyValue("auth.saml", "name").MustString("SAML")
}
func (hs *HTTPServer) samlSingleLogoutEnabled() bool {
return hs.SettingsProvider.KeyValue("auth.saml", "single_logout").MustBool(false) && hs.samlEnabled()
}