From d0ed6ff9846696590121f63f3aa84300a61071e0 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 24 May 2022 10:13:40 +0200
Subject: [PATCH] Fix Scrutinizer issues

---
 modules/saml/lib/Controller/Metadata.php               | 3 ++-
 modules/saml/lib/Controller/SingleLogout.php           | 4 ++--
 modules/saml/lib/Controller/WebBrowserSingleSignOn.php | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/saml/lib/Controller/Metadata.php b/modules/saml/lib/Controller/Metadata.php
index 84e3efd54..15bb343e7 100644
--- a/modules/saml/lib/Controller/Metadata.php
+++ b/modules/saml/lib/Controller/Metadata.php
@@ -7,6 +7,7 @@ namespace SimpleSAML\Module\saml\Controller;
 use Exception;
 use SimpleSAML\Configuration;
 use SimpleSAML\Error;
+use SimpleSAML\HTTP\RunnableResponse;
 use SimpleSAML\Metadata as SSPMetadata;
 use SimpleSAML\Module;
 use SimpleSAML\Module\saml\IdP\SAML2 as SAML2_IdP;
@@ -67,7 +68,7 @@ class Metadata
      */
     public function metadata(Request $request): RunnableResponse
     {
-        if (!$this->config->getOptionalBoolean('enable.saml20-idp', false) || !Module::isModuleEnabled('saml')) {
+        if ($this->config->getBoolean('enable.saml20-idp') === false || !Module::isModuleEnabled('saml')) {
             throw new Error\Error('NOACCESS', null, 403);
         }
 
diff --git a/modules/saml/lib/Controller/SingleLogout.php b/modules/saml/lib/Controller/SingleLogout.php
index 1b2fe5f6a..f5f9e344a 100644
--- a/modules/saml/lib/Controller/SingleLogout.php
+++ b/modules/saml/lib/Controller/SingleLogout.php
@@ -54,7 +54,7 @@ class SingleLogout
     {
         Logger::info('SAML2.0 - IdP.SingleLogoutService: Accessing SAML 2.0 IdP endpoint SingleLogoutService');
 
-        if (!$this->config->getOptionalBoolean('enable.saml20-idp', false) || !Module::isModuleEnabled('saml')) {
+        if ($this->config->getBoolean('enable.saml20-idp') === false || !Module::isModuleEnabled('saml')) {
             throw new Error\Error('NOACCESS', null, 403);
         }
 
@@ -89,7 +89,7 @@ class SingleLogout
     {
         Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout');
 
-        if (!$this->config->getOptionalBoolean('enable.saml20-idp', false) || !Module::isModuleEnabled('saml')) {
+        if ($this->config->getOptionalBoolean('enable.saml20-idp') === false || !Module::isModuleEnabled('saml')) {
             throw new Error\Error('NOACCESS', null, 403);
         }
 
diff --git a/modules/saml/lib/Controller/WebBrowserSingleSignOn.php b/modules/saml/lib/Controller/WebBrowserSingleSignOn.php
index 032d41f21..5cac59c8a 100644
--- a/modules/saml/lib/Controller/WebBrowserSingleSignOn.php
+++ b/modules/saml/lib/Controller/WebBrowserSingleSignOn.php
@@ -55,7 +55,7 @@ class WebBrowserSingleSignOn
      */
     public function artifactResolutionService(): RunnableResponse
     {
-        if (!$this->config->getOptionalBoolean('enable.saml20-idp', false) || !Module::isModuleEnabled('saml')) {
+        if ($this->config->getBoolean('enable.saml20-idp') === false || !Module::isModuleEnabled('saml')) {
             throw new Error\Error('NOACCESS', null, 403);
         }
 
@@ -123,7 +123,7 @@ class WebBrowserSingleSignOn
     {
         Logger::info('SAML2.0 - IdP.SSOService: Accessing SAML 2.0 IdP endpoint SSOService');
 
-        if (!$this->config->getOptionalBoolean('enable.saml20-idp', false) || !Module::isModuleEnabled('saml')) {
+        if ($this->config->getBoolean('enable.saml20-idp') === false || !Module::isModuleEnabled('saml')) {
             throw new Error\Error('NOACCESS', null, 403);
         }
 
-- 
GitLab