From 9a60843f9dc16c98b904f329e664f4f2b4426a4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20P=C3=A9rez=20Crespo?= <jaime.perez@uninett.no>
Date: Mon, 15 Oct 2012 13:21:13 +0000
Subject: [PATCH] Add support for AuthnRequestsSigned and WantAssertionsSigned
 when generating SSP metadata from a SPSSODescriptor.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3190 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Metadata/SAMLParser.php | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index 8822451ab..815b24ff3 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -623,6 +623,15 @@ class SimpleSAML_Metadata_SAMLParser {
 			$ret['keys'] = $spd['keys'];
 		}
 
+		/* Add validate.authnrequest. */
+		if (array_key_exists('AuthnRequestsSigned', $spd)) {
+			$ret['validate.authnrequest'] = $spd['AuthnRequestsSigned'];
+		}
+
+		/* Add saml20.sign.assertion. */
+		if (array_key_exists('WantAssertionsSigned', $spd)) {
+			$ret['saml20.sign.assertion'] = $spd['WantAssertionsSigned'];
+		}
 
 		/* Add extensions. */
 		$this->addExtensions($ret, $spd);
@@ -810,6 +819,16 @@ class SimpleSAML_Metadata_SAMLParser {
 			self::parseAttributeConsumerService($attcs[0], $sp);
 		}
 
+		/* Check AuthnRequestsSigned */
+		if ($element->AuthnRequestsSigned !== NULL) {
+			$sp['AuthnRequestsSigned'] = $element->AuthnRequestsSigned;
+		}
+
+		/* Check WantAssertionsSigned */
+		if ($element->WantAssertionsSigned !== NULL) {
+			$sp['WantAssertionsSigned'] = $element->WantAssertionsSigned;
+		}
+
 		$this->spDescriptors[] = $sp;
 	}
 
-- 
GitLab