diff --git a/packages/grafana-data/src/types/constants.ts b/packages/grafana-data/src/types/constants.ts index f82ea4115ac..b8f6fa1bbf1 100644 --- a/packages/grafana-data/src/types/constants.ts +++ b/packages/grafana-data/src/types/constants.ts @@ -1,2 +1,3 @@ export const GAUGE_DEFAULT_MINIMUM = 0; export const GAUGE_DEFAULT_MAXIMUM = 100; +export const DEFAULT_SAML_NAME = 'SAML'; diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index 75b83c7e718..c2816f44d34 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -44,6 +44,7 @@ export class GrafanaBootConfig implements GrafanaConfig { ldapEnabled = false; sigV4AuthEnabled = false; samlEnabled = false; + samlName = ''; autoAssignOrg = true; verifyEmailEnabled = false; oauth: any; diff --git a/pkg/api/login.go b/pkg/api/login.go index 35440745e43..d149c731e0d 100644 --- a/pkg/api/login.go +++ b/pkg/api/login.go @@ -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() } diff --git a/public/app/core/components/Login/LoginServiceButtons.tsx b/public/app/core/components/Login/LoginServiceButtons.tsx index e906094bea1..ffb4c5c046c 100644 --- a/public/app/core/components/Login/LoginServiceButtons.tsx +++ b/public/app/core/components/Login/LoginServiceButtons.tsx @@ -2,7 +2,7 @@ import React from 'react'; import config from 'app/core/config'; import { css, cx } from '@emotion/css'; import { Icon, IconName, LinkButton, useStyles, useTheme2, VerticalGroup } from '@grafana/ui'; -import { GrafanaTheme, GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme, GrafanaTheme2, DEFAULT_SAML_NAME } from '@grafana/data'; import { pickBy } from 'lodash'; export interface LoginService { @@ -24,7 +24,7 @@ const loginServices: () => LoginServices = () => { saml: { bgColor: '#464646', enabled: config.samlEnabled, - name: 'SAML', + name: config.samlName || DEFAULT_SAML_NAME, icon: 'key-skeleton-alt', }, google: {