Skip to content
Snippets Groups Projects
Commit bb528b7d authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Update to modern array syntax

parent efc3de24
No related branches found
No related tags found
No related merge requests found
...@@ -293,21 +293,21 @@ class Metadata ...@@ -293,21 +293,21 @@ class Metadata
if (is_string($nameIdPolicy)) { if (is_string($nameIdPolicy)) {
// handle old configurations where 'NameIDPolicy' was used to specify just the format // handle old configurations where 'NameIDPolicy' was used to specify just the format
$policy = array('Format' => $nameIdPolicy); $policy = ['Format' => $nameIdPolicy];
} elseif (is_array($nameIdPolicy)) { } elseif (is_array($nameIdPolicy)) {
// handle current configurations specifying an array in the NameIDPolicy config option // handle current configurations specifying an array in the NameIDPolicy config option
$nameIdPolicy_cf = \SimpleSAML_Configuration::loadFromArray($nameIdPolicy); $nameIdPolicy_cf = \SimpleSAML_Configuration::loadFromArray($nameIdPolicy);
$policy = array( $policy = [
'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT), 'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT),
'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true), 'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true),
); ];
$spNameQualifier = $nameIdPolicy_cf->getString('SPNameQualifier', false); $spNameQualifier = $nameIdPolicy_cf->getString('SPNameQualifier', false);
if ($spNameQualifier !== false) { if ($spNameQualifier !== false) {
$policy['SPNameQualifier'] = $spNameQualifier; $policy['SPNameQualifier'] = $spNameQualifier;
} }
} elseif ($nameIdPolicy === null) { } elseif ($nameIdPolicy === null) {
// when NameIDPolicy is unset or set to null, default to transient as before // when NameIDPolicy is unset or set to null, default to transient as before
$policy = array('Format' => \SAML2\Constants::NAMEID_TRANSIENT); $policy = ['Format' => \SAML2\Constants::NAMEID_TRANSIENT];
} }
return $policy; return $policy;
......
...@@ -237,7 +237,7 @@ class SP extends Source ...@@ -237,7 +237,7 @@ class SP extends Source
} elseif (is_array($state['saml:NameIDPolicy'])) { } elseif (is_array($state['saml:NameIDPolicy'])) {
$policy = $state['saml:NameIDPolicy']; $policy = $state['saml:NameIDPolicy'];
} elseif ($state['saml:NameIDPolicy'] === null) { } elseif ($state['saml:NameIDPolicy'] === null) {
$policy = array('Format' => \SAML2\Constants::NAMEID_TRANSIENT); $policy = ['Format' => \SAML2\Constants::NAMEID_TRANSIENT];
} }
if ($policy !== null) { if ($policy !== null) {
$ar->setNameIdPolicy($policy); $ar->setNameIdPolicy($policy);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment