From 533213e8611ad7caca63aa1fcdf5ad5135569ab9 Mon Sep 17 00:00:00 2001
From: Remy Blom <remy.blom@hku.nl>
Date: Mon, 23 Jan 2017 17:10:44 +0100
Subject: [PATCH] feature: AttributeCopy can take array for 1 attribute

---
 modules/core/lib/Auth/Process/AttributeCopy.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/core/lib/Auth/Process/AttributeCopy.php b/modules/core/lib/Auth/Process/AttributeCopy.php
index bd9b9fd83..4b83e0557 100644
--- a/modules/core/lib/Auth/Process/AttributeCopy.php
+++ b/modules/core/lib/Auth/Process/AttributeCopy.php
@@ -40,7 +40,7 @@ class sspmod_core_Auth_Process_AttributeCopy extends SimpleSAML_Auth_ProcessingF
 				throw new Exception('Invalid source attribute name: ' . var_export($source, TRUE));
 			}
 
-			if(!is_string($destination)) {
+			if(!is_string($destination) && !is_array($destination)) {
 				throw new Exception('Invalid destination attribute name: ' . var_export($destination, TRUE));
 			}
 
@@ -62,7 +62,13 @@ class sspmod_core_Auth_Process_AttributeCopy extends SimpleSAML_Auth_ProcessingF
 
 		foreach($attributes as $name => $values) {
 			if (array_key_exists($name,$this->map)){
-				$attributes[$this->map[$name]] = $values;
+				if (!is_array($this->map[$name])) {
+					$attributes[$this->map[$name]] = $values;
+				} else {
+					foreach ($this->map[$name] as $to_map) {
+						$attributes[$to_map] = $values;
+					}
+				}
 			}
 		}
 
-- 
GitLab