From 4e65a8d755436eaed0ad031443a654ac567fd91c Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 17 May 2022 19:54:14 -0700 Subject: [PATCH 1/2] Reduce SAML debugging output to actual error conditions --- app/Services/Saml.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/Saml.php b/app/Services/Saml.php index f2f3ee588d..ab56e5c944 100644 --- a/app/Services/Saml.php +++ b/app/Services/Saml.php @@ -130,11 +130,12 @@ class Saml $this->clearData(); } - \Log::debug('Trying to create a new OneLogin_Saml2_Auth object '); try { $this->_auth = new OneLogin_Saml2_Auth($this->_settings); } catch (Exception $e) { - \Log::error('Trying OneLogin_Saml2_Auth failed. Setting SAML enabled to false. OneLogin_Saml2_Auth error message is: '. $e->getMessage()); + if ( $this->isEnabled() ) { // $this->loadSettings() initializes this to true if SAML is enabled by settings. + \Log::error('Trying OneLogin_Saml2_Auth failed. Setting SAML enabled to false. OneLogin_Saml2_Auth error message is: '. $e->getMessage()); + } $this->_enabled = false; } } @@ -157,7 +158,6 @@ class Saml $this->_enabled = $setting->saml_enabled == '1'; if ($this->isEnabled()) { - \Log::debug('SAML is enabled according to loadSettings()'); //Let onelogin/php-saml know to use 'X-Forwarded-*' headers if it is from a trusted proxy OneLogin_Saml2_Utils::setProxyVars(request()->isFromTrustedProxy()); From b4a0d33ba8aa9ba44f5da31050426a3d6a974d14 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 17 May 2022 19:57:42 -0700 Subject: [PATCH 2/2] Reduce logging further; we know the main error condition now --- app/Http/Controllers/Auth/LoginController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 3ee323377d..9e94740506 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -104,15 +104,12 @@ class LoginController extends Controller */ private function loginViaSaml(Request $request) { - \Log::debug('Attempting to login via SAML'); $saml = $this->saml; $samlData = $request->session()->get('saml_login'); if ($saml->isEnabled() && ! empty($samlData)) { - \Log::debug('SAML is enabled, and the samleData is not empty'); try { - Log::debug('Attempting to log user in by SAML authentication.'); $user = $saml->samlLogin($samlData); if (!is_null($user)) {