mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
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:
parent
5219c72a6c
commit
706a665240
@ -1,2 +1,3 @@
|
||||
export const GAUGE_DEFAULT_MINIMUM = 0;
|
||||
export const GAUGE_DEFAULT_MAXIMUM = 100;
|
||||
export const DEFAULT_SAML_NAME = 'SAML';
|
||||
|
@ -44,6 +44,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
||||
ldapEnabled = false;
|
||||
sigV4AuthEnabled = false;
|
||||
samlEnabled = false;
|
||||
samlName = '';
|
||||
autoAssignOrg = true;
|
||||
verifyEmailEnabled = false;
|
||||
oauth: any;
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user