From dcfd5b24e1b56fad0f64f7b80ceaa3ff111b2a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Wed, 7 Jan 2009 10:52:34 +0000 Subject: [PATCH] Adding Shibboleth Scope extension to XML metadata git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1086 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Metadata/SAMLBuilder.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index b04bbf16f..756700c85 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -72,9 +72,10 @@ class SimpleSAML_Metadata_SAMLBuilder { private function addExtensions($metadata) { $extensions = $this->createElement('Extensions'); -# $extensions->setAttribute('xmlns:saml', 'urn:oasis:names:tc:SAML:2.0:assertion'); + $includeExtensions = FALSE; if (array_key_exists('tags', $metadata)) { + $includeExtensions = TRUE; $attr = $this->createElement('saml:Attribute', 'urn:oasis:names:tc:SAML:2.0:assertion'); $attr->setAttribute('Name', 'tags'); foreach ($metadata['tags'] AS $tag) { @@ -83,8 +84,17 @@ class SimpleSAML_Metadata_SAMLBuilder { $extensions->appendChild($attr); } - - $this->entityDescriptor->appendChild($extensions); + if (array_key_exists('scope', $metadata)) { + $includeExtensions = TRUE; + foreach ($metadata['scope'] AS $scopetext) { + $scope = $this->createElement('shibmd:Scope', 'urn:mace:shibboleth:metadata:1.0'); + $scope->setAttribute('regex', 'false'); + $scope->appendChild($this->document->createTextNode($scopetext)); + $extensions->appendChild($scope); + } + + } + if ($includeExtensions) $this->entityDescriptor->appendChild($extensions); } -- GitLab