From 430d2ecb8c48bdf5234dcfbc241f77013799e9cb Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 5 Jan 2010 13:51:51 +0000 Subject: [PATCH] core:AttributeMap: Allow multiple target attributes. Patch by pitbulk@gmail.com, attached to issue 249. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2072 44740490-163a-0410-bde0-09ae8108e29a --- modules/core/lib/Auth/Process/AttributeMap.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/core/lib/Auth/Process/AttributeMap.php b/modules/core/lib/Auth/Process/AttributeMap.php index a2d0ac26a..8df240c3b 100644 --- a/modules/core/lib/Auth/Process/AttributeMap.php +++ b/modules/core/lib/Auth/Process/AttributeMap.php @@ -37,7 +37,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi throw new Exception('Invalid attribute name: ' . var_export($origName, TRUE)); } - if(!is_string($newName)) { + if(!is_string($newName) && !is_array($newName)) { throw new Exception('Invalid attribute name: ' . var_export($newName, TRUE)); } @@ -82,8 +82,14 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi foreach($attributes as $name => $values) { if(array_key_exists($name, $this->map)) { - $attributes[$this->map[$name]] = $values; unset($attributes[$name]); + if(!is_array($this->map[$name])) { + $attributes[$this->map[$name]] = $values; + } else { + foreach($this->map[$name] as $to_map) { + $attributes[$to_map] = $values; + } + } } } -- GitLab