From e6b448a07ffcb1e1d866382adeda553c4b33cdec Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Sat, 19 Aug 2017 10:58:40 +0200 Subject: [PATCH] Flexible namespace --- modules/adfs/lib/IdP/ADFS.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php index 973e8055a..af11f7bd3 100644 --- a/modules/adfs/lib/IdP/ADFS.php +++ b/modules/adfs/lib/IdP/ADFS.php @@ -61,7 +61,14 @@ MSG; if ((!is_array($values)) || (count($values) == 0)) { continue; } + $namespace = "http://schemas.xmlsoap.org/claims"; + $slash = strrpos($name, '/'); + if ($slash !== false) { + $namespace = substr($name, 0, $slash); + $name = substr($name, $slash + 1); + } $name = htmlspecialchars($name); + $namespace = htmlspecialchars($namespace); foreach ($values as $value) { if ((!isset($value)) || ($value === '')) { continue; @@ -69,7 +76,7 @@ MSG; $value = htmlspecialchars($value); $result .= <<<MSG - <saml:Attribute AttributeNamespace="http://schemas.xmlsoap.org/claims" AttributeName="$name"> + <saml:Attribute AttributeNamespace="$namespace" AttributeName="$name"> <saml:AttributeValue>$value</saml:AttributeValue> </saml:Attribute> MSG; -- GitLab