Skip to content
Snippets Groups Projects
Commit 430d2ecb authored by Olav Morken's avatar Olav Morken
Browse files

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
parent d0de48c0
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi ...@@ -37,7 +37,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi
throw new Exception('Invalid attribute name: ' . var_export($origName, TRUE)); 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)); throw new Exception('Invalid attribute name: ' . var_export($newName, TRUE));
} }
...@@ -82,8 +82,14 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi ...@@ -82,8 +82,14 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi
foreach($attributes as $name => $values) { foreach($attributes as $name => $values) {
if(array_key_exists($name, $this->map)) { if(array_key_exists($name, $this->map)) {
$attributes[$this->map[$name]] = $values;
unset($attributes[$name]); 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;
}
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment