From 4533ad6fb838f3893e427f149587215d99aef374 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 23 Oct 2007 11:00:22 +0000
Subject: [PATCH] Traversing multiple attribute statements in one assertion in
 Shib SP

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@47 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/XML/Shib13/AuthnResponse.php | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
index 98a029550..e56bd9396 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
@@ -242,15 +242,22 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse {
 
 				}
 				
-				if (isset($assertion->AttributeStatement->Attribute)) {
-					foreach ($assertion->AttributeStatement->Attribute AS $attribute) {
+				
+				// Traverse AttributeStatements
+				foreach ($assertion->AttributeStatement AS $attributestatement) {
+				
+					// Traverse Attributes
+					foreach ($attributestatement->Attribute AS $attribute) {
 						$values = array();
+						
+						// Traverse Values
 						foreach ($attribute->AttributeValue AS $val) {
 							$values[] = (string) $val;
 						}
 						
 						$attributes[(string)$attribute['AttributeName']] = $values;
 					}
+
 				}
 				
 			}
@@ -260,12 +267,12 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse {
 			echo "<PRE>token:";
 			echo htmlentities($token->saveXML());
 			echo ":</PRE>";
-			*/
-			/*
+
+		
 			echo '<pre>Attributes: ';
 			print_r($attributes);
 			echo '</pre>';
-	*/
+			*/
 		}
 		return $attributes;
 		
-- 
GitLab