Skip to content

Commit

Permalink
SAMLAuth::getValuesWithRule() method bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
msyk committed Jun 19, 2024
1 parent 67a7319 commit 782758c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/php/SAMLAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 782758c

Please sign in to comment.