From 2a105f451423ff895a075209dad236b7fa857f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 31 Aug 2021 16:13:19 +0200 Subject: [PATCH] Add a warning log message that `passport-saml` will require a `cert` config parameter imminently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/friendly-tables-heal.md | 7 +++++++ plugins/auth-backend/src/providers/saml/provider.ts | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/friendly-tables-heal.md diff --git a/.changeset/friendly-tables-heal.md b/.changeset/friendly-tables-heal.md new file mode 100644 index 0000000000..8aa987d409 --- /dev/null +++ b/.changeset/friendly-tables-heal.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-auth-backend': patch +--- + +Add a warning log message that `passport-saml` will require a `cert` config parameter imminently. + +We intend to upgrade this package soon, past the point where we will start to strictly require the `auth.saml.cert` configuration parameter to be present. To avoid issues starting your auth backend, please diff --git a/plugins/auth-backend/src/providers/saml/provider.ts b/plugins/auth-backend/src/providers/saml/provider.ts index fe721fa376..5b95634414 100644 --- a/plugins/auth-backend/src/providers/saml/provider.ts +++ b/plugins/auth-backend/src/providers/saml/provider.ts @@ -119,7 +119,7 @@ export type SamlProviderOptions = {}; export const createSamlProvider = ( _options?: SamlProviderOptions, ): AuthProviderFactory => { - return ({ providerId, globalConfig, config, tokenIssuer }) => { + return ({ providerId, globalConfig, config, tokenIssuer, logger }) => { const opts = { callbackUrl: `${globalConfig.baseUrl}/${providerId}/handler/frame`, entryPoint: config.getString('entryPoint'), @@ -141,8 +141,14 @@ export const createSamlProvider = ( // passport-saml will return an error if the `cert` key is set, and the value is empty. // Since we read from config (such as environment variables) an empty string should be equal to being unset. if (!opts.cert) { + logger.warn( + 'SamlAuthProvider was initialized without a cert configuration parameter. ' + + 'This will soon be required by the underlying passport-saml library, which may soon lead to failures to start the auth backend. ' + + 'Please add an "auth.saml.cert" config parameter.', + ); delete opts.cert; } + return new SamlAuthProvider(opts); }; };