From 0a29747424009c72e821aaea3d76c39cb159d89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Fri, 15 May 2009 10:18:19 +0000 Subject: [PATCH] Move Exension fields within IdPDescriptor and SPdescriptor. As discussed on the mailinglist. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1505 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Metadata/SAMLBuilder.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 05d9d7a93..a41031764 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -91,8 +91,11 @@ class SimpleSAML_Metadata_SAMLBuilder { return $this->document->saveXML(); } - - private function addExtensions($metadata) { + /** + * @param $metadata Metadata array + * @param $e Reference to the element where the Extensions element should be included. + */ + private function addExtensions($metadata, &$e = NULL) { $extensions = $this->createElement('Extensions'); $includeExtensions = FALSE; @@ -127,7 +130,13 @@ class SimpleSAML_Metadata_SAMLBuilder { $extensions->appendChild($scope); } } - if ($includeExtensions) $this->entityDescriptor->appendChild($extensions); + if ($includeExtensions) { + if (isset($e)) { + $e->appendChild($extensions); + } else { + $this->entityDescriptor->appendChild($extensions); + } + } } public static function arrayize($data) { @@ -230,7 +239,7 @@ class SimpleSAML_Metadata_SAMLBuilder { $e->setAttribute('protocolSupportEnumeration', 'urn:oasis:names:tc:SAML:2.0:protocol'); - $this->addExtensions($metadata); + $this->addExtensions($metadata, $e); $this->addCertificate($e, $metadata); @@ -352,7 +361,7 @@ class SimpleSAML_Metadata_SAMLBuilder { $e->setAttribute('WantAuthnRequestSigned', 'true'); } - $this->addExtensions($metadata); + $this->addExtensions($metadata, $e); $this->addCertificate($e, $metadata); -- GitLab