From 02c36f5d417e4ea46c3b23260ba0c511348a13ee Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 4 Aug 2009 11:18:48 +0000 Subject: [PATCH] saml2_Message: Support decoding of base64-encoded attributes. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1627 44740490-163a-0410-bde0-09ae8108e29a --- modules/saml2/lib/Message.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/saml2/lib/Message.php b/modules/saml2/lib/Message.php index dc11c24a7..705bde06c 100644 --- a/modules/saml2/lib/Message.php +++ b/modules/saml2/lib/Message.php @@ -667,6 +667,23 @@ class sspmod_saml2_Message { } /* As far as we can tell, the assertion is valid. */ + + + /* Maybe we need to base64 decode the attributes in the assertion? */ + if ($idpMetadata->getBoolean('base64attributes', FALSE)) { + $attributes = $assertion->getAttributes(); + $newAttributes = array(); + foreach ($attributes as $name => $values) { + $newAttributes[$name] = array(); + foreach ($values as $value) { + foreach(explode('_', $value) AS $v) { + $newAttributes[$name][] = base64_decode($v); + } + } + } + $assertion->setAttributes($newAttributes); + } + return $assertion; } -- GitLab