From c9af78ab3e30a86a783942e4177bf638910e51de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no> Date: Fri, 26 Jan 2018 11:08:21 +0100 Subject: [PATCH] Handle NameIDPolicy with values different than a string in the metadata page. --- modules/saml/www/sp/metadata.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index abf6473a2..c2f7a3b92 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -138,9 +138,16 @@ if ($certInfo !== null && array_key_exists('certData', $certInfo)) { $certData = null; } -$format = $spconfig->getString('NameIDPolicy', null); +$format = $spconfig->getValue('NameIDPolicy', null); if ($format !== null) { - $metaArray20['NameIDFormat'] = $format; + if (is_array($format)) { + $metaArray20['NameIDFormat'] = SimpleSAML_Configuration::loadFromArray($format)->getString( + 'Format', + \SAML2\Constants::NAMEID_TRANSIENT + ); + } elseif (is_string($format)) { + $metaArray20['NameIDFormat'] = $format; + } } $name = $spconfig->getLocalizedString('name', null); -- GitLab