From 782758cbd3ae7e8f8c4d353628fe56c7a4e43cf6 Mon Sep 17 00:00:00 2001 From: Masayuki Nii Date: Wed, 19 Jun 2024 13:49:06 +0900 Subject: [PATCH] SAMLAuth::getValuesWithRule() method bug fixed. --- src/php/SAMLAuth.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/php/SAMLAuth.php b/src/php/SAMLAuth.php index 56c83840..d47400fd 100644 --- a/src/php/SAMLAuth.php +++ b/src/php/SAMLAuth.php @@ -121,17 +121,19 @@ private function getValuesWithRule($rule): string { $returnValue = null; $attributes = $this->authSimple->getAttributes(); - $comps = explode('|', $rule); if (is_array($rule)) { $returnValue = ''; foreach ($rule as $item) { $returnValue = ((strlen($returnValue) > 0) ? ' ' : '') . $returnValue; $returnValue .= $this->getValuesWithRule($item); } - } else if (isset($attributes[$comps[0]][$comps[1]]) && count($comps) === 2) { - $returnValue = $attributes[$comps[0]][$comps[1]]; - } else if (isset($attributes[$rule])) { - $returnValue = $attributes[$rule]; + } else { + $comps = explode('|', $rule); + if (isset($attributes[$comps[0]][$comps[1]]) && count($comps) === 2) { + $returnValue = $attributes[$comps[0]][$comps[1]]; + } else if (isset($attributes[$rule])) { + $returnValue = $attributes[$rule]; + } } if (is_null($returnValue)) { Logger::getInstance()->setWarningMessage('You have to set up the variable $samlAttrRules in params.php'