From f77c0fdfe40ec51f1d445d161c54ae726c4acfa8 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Thu, 25 Aug 2022 21:31:14 +0200 Subject: [PATCH] add saml sp only if vars present --- config/initializers/saml_idp.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/initializers/saml_idp.rb b/config/initializers/saml_idp.rb index 65f51b116..7e849bea4 100644 --- a/config/initializers/saml_idp.rb +++ b/config/initializers/saml_idp.rb @@ -17,12 +17,14 @@ if ENV['SAML_IDP_ENABLED'] == 'enabled' } } - service_providers = { - "https://#{ENV.fetch('SAML_DOLIST_HOST')}" => { - response_hosts: [ENV.fetch('SAML_DOLIST_HOST')], - cert: ENV.fetch("SAML_DOLIST_CERTIFICATE") - } - } + service_providers = {} + if ENV['SAML_DOLIST_HOST'].present? + service_providers["https://#{ENV.fetch('SAML_DOLIST_HOST')}"] = + { + response_hosts: [ENV.fetch('SAML_DOLIST_HOST')], + cert: ENV.fetch("SAML_DOLIST_CERTIFICATE") + } + end config.service_provider.finder = -> (entity_id) do service_providers[entity_id]