From e6fc9f01a3611c501539c6be6c7db51c98bfb4b1 Mon Sep 17 00:00:00 2001 From: Moritz Schlarb Date: Fri, 11 Mar 2022 14:32:40 +0100 Subject: [PATCH] Allow SAML authentication provider to be named Using `CMD_SAML_PROVIDERNAME` and the respective auth provider objects in the configuration structures. Signed-off-by: Moritz Schlarb --- app.js | 1 + docs/content/configuration.md | 1 + lib/config/default.js | 1 + lib/config/environment.js | 1 + public/docs/release-notes.md | 1 + public/views/shared/signin-modal.ejs | 2 +- 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 86363482f..53859a277 100644 --- a/app.js +++ b/app.js @@ -212,6 +212,7 @@ app.locals.authProviders = { ldap: config.isLDAPEnable, ldapProviderName: config.ldap.providerName, saml: config.isSAMLEnable, + samlProviderName: config.saml.providerName, oauth2: config.isOAuth2Enable, oauth2ProviderName: config.oauth2.providerName, openID: config.isOpenIDEnable, diff --git a/docs/content/configuration.md b/docs/content/configuration.md index 9982620ec..536fffd4a 100644 --- a/docs/content/configuration.md +++ b/docs/content/configuration.md @@ -228,6 +228,7 @@ these are rarely used for various reasons. | | `CMD_SAML_ATTRIBUTE_ID` | **no default**, `sAMAccountName` | attribute map for `id` (optional, default: NameID of SAML response) | | | `CMD_SAML_ATTRIBUTE_USERNAME` | **no default**, `mailNickname` | attribute map for `username` (optional, default: NameID of SAML response) | | | `CMD_SAML_ATTRIBUTE_EMAIL` | **no default**, `mail` | attribute map for `email` (optional, default: NameID of SAML response if `CMD_SAML_IDENTIFIERFORMAT` is default) | +| | `CMD_SAML_PROVIDERNAME` | **no default**, `My institution` | Optional name to be displayed at login form indicating the SAML provider | ### Twitter Login diff --git a/lib/config/default.js b/lib/config/default.js index 89de46727..1e3764ad2 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -144,6 +144,7 @@ module.exports = { tlsca: undefined }, saml: { + providerName: undefined, idpSsoUrl: undefined, idpCert: undefined, clientCert: undefined, diff --git a/lib/config/environment.js b/lib/config/environment.js index 8c161341e..e773a2c81 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -134,6 +134,7 @@ module.exports = { tlsca: process.env.CMD_LDAP_TLS_CA }, saml: { + providerName: process.env.CMD_SAML_PROVIDERNAME, idpSsoUrl: process.env.CMD_SAML_IDPSSOURL, idpCert: process.env.CMD_SAML_IDPCERT, clientCert: process.env.CMD_SAML_CLIENTCERT, diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index 4faf26257..8d0af33eb 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -8,6 +8,7 @@ ### Enhancements - Libravatar avatars render as ident-icons when no avatar image was uploaded to Libravatar or Gravatar - Add database connection error message to log output +- Allow SAML authentication provider to be named ## 1.9.2 2021-12-03 diff --git a/public/views/shared/signin-modal.ejs b/public/views/shared/signin-modal.ejs index 40f01b577..d2529fba8 100644 --- a/public/views/shared/signin-modal.ejs +++ b/public/views/shared/signin-modal.ejs @@ -45,7 +45,7 @@ <% } %> <% if (authProviders.saml) { %> - <%= __('Sign in via %s', 'SAML') %> + <%= __('Sign in via %s', authProviders.samlProviderName || 'SAML') %> <% } %> <% if (authProviders.oauth2) { %>