diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php index ad20c4c748507fe8b1c0efe48a9d36698b3909f9..133d9ffe9ab176e7b16dd6146490517e4521f7e2 100644 --- a/lib/SimpleSAML/Utils/Config/Metadata.php +++ b/lib/SimpleSAML/Utils/Config/Metadata.php @@ -297,7 +297,7 @@ class Metadata $policy = array('Format' => $nameIdPolicy); } elseif (is_array($nameIdPolicy)) { // 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( 'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT), 'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true), diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php index 734a4067c187e901fb4dbbb82a7caa18d674cffe..a42d3e34df98e805602eb8e0b7f44064c5b9a5f9 100644 --- a/modules/saml/lib/Message.php +++ b/modules/saml/lib/Message.php @@ -442,26 +442,7 @@ class sspmod_saml_Message $nameIdPolicy = $spMetadata->getValue('NameIDPolicy'); } - $policy = null; - if (is_string($nameIdPolicy)) { - // handle old configurations where 'NameIDPolicy' was used to specify just the format - $policy = array('Format' => $nameIdPolicy); - } elseif (is_array($nameIdPolicy)) { - // handle current configurations specifying an array in the NameIDPolicy config option - $nameIdPolicy_cf = SimpleSAML_Configuration::loadFromArray($nameIdPolicy); - $policy = array( - 'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT), - 'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true), - ); - $spNameQualifier = $nameIdPolicy_cf->getString('SPNameQualifier', false); - if ($spNameQualifier !== false) { - $policy['SPNameQualifier'] = $spNameQualifier; - } - } elseif ($nameIdPolicy === null) { - // when NameIDPolicy is unset or set to null, default to transient as before - $policy = array('Format' => \SAML2\Constants::NAMEID_TRANSIENT); - } - + $policy = \SimpleSAML\Utils\Config\Metadata::parseNameIdPolicy($nameIdPolicy); if ($policy !== null) { // either we have a policy set, or we used the transient default $ar->setNameIdPolicy($policy);