From 4f58d39f1fceb8146f909856e3020f4de50bab6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Thu, 8 Jan 2009 10:44:08 +0000 Subject: [PATCH] Fix for syntax for XSD:duration in CacheDuration and namespace of attributevalue in extensions git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1093 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Metadata/SAMLBuilder.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 894ac465c..8484c595d 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -53,7 +53,7 @@ class SimpleSAML_Metadata_SAMLBuilder { } if ($this->maxCache !== NULL) - $this->entityDescriptor->setAttribute('cacheDuration', $this->maxCache); + $this->entityDescriptor->setAttribute('cacheDuration', 'PT' . $this->maxCache . 'S'); if ($this->maxDuration !== NULL) $this->entityDescriptor->setAttribute('validUntil', SimpleSAML_Utilities::generateTimestamp(time() + $this->maxDuration)); } @@ -99,7 +99,7 @@ class SimpleSAML_Metadata_SAMLBuilder { $attr = $this->createElement('saml:Attribute', 'urn:oasis:names:tc:SAML:2.0:assertion'); $attr->setAttribute('Name', 'tags'); foreach ($metadata['tags'] AS $tag) { - $attr->appendChild($this->createTextElement('saml:AttributeValue', $tag)); + $attr->appendChild($this->createTextElement('saml:AttributeValue', $tag, 'urn:oasis:names:tc:SAML:2.0:assertion')); } $extensions->appendChild($attr); } @@ -110,7 +110,7 @@ class SimpleSAML_Metadata_SAMLBuilder { $attr->setAttribute('Name', 'hint.cidr'); $hints = self::arrayize($metadata['hint.cidr']); foreach ($hints AS $hint) { - $attr->appendChild($this->createTextElement('saml:AttributeValue', $hint)); + $attr->appendChild($this->createTextElement('saml:AttributeValue', $hint, 'urn:oasis:names:tc:SAML:2.0:assertion')); } $extensions->appendChild($attr); } @@ -565,11 +565,15 @@ class SimpleSAML_Metadata_SAMLBuilder { * @param string $text The text contained in the element. * @return DOMElement The new DOMElement with a text node. */ - private function createTextElement($name, $text) { + private function createTextElement($name, $text, $ns = NULL) { assert('is_string($name)'); assert('is_string($text)'); - $node = $this->createElement($name); + if ($ns !== NULL) { + $node = $this->createElement($name, $ns); + } else { + $node = $this->createElement($name); + } $node->appendChild($this->document->createTextNode($text)); return $node; -- GitLab