From 534b352ebc012b98863e3577fe92009e9639e4d2 Mon Sep 17 00:00:00 2001 From: very-ape Date: Mon, 17 May 2021 11:11:19 -0700 Subject: [PATCH] Prevent execution of SAML functions and show or log a message when the addon isn't configured. --- saml/saml.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/saml/saml.php b/saml/saml.php index 5c50017d..204e79d0 100755 --- a/saml/saml.php +++ b/saml/saml.php @@ -29,6 +29,11 @@ function saml_init($a) return; } + if (!saml_is_configured()) { + echo "Please configure the SAML add-on via the admin interface."; + return; + } + switch ($a->argv[1]) { case "metadata.xml": saml_metadata(); @@ -104,6 +109,7 @@ function saml_is_configured() function saml_sso_initiate(&$a, &$b) { if (!saml_is_configured()) { + Logger::warning('SAML SSO tried to trigger, but the SAML addon is not configured yet!'); return; } @@ -168,6 +174,11 @@ function saml_sso_reply($a) function saml_slo_initiate(&$a, &$b) { + if (!saml_is_configured()) { + Logger::warning('SAML SLO tried to trigger, but the SAML addon is not configured yet!'); + return; + } + $auth = new \OneLogin\Saml2\Auth(saml_settings()); $sloBuiltUrl = $auth->logout();