Skip to content
Snippets Groups Projects
Commit 1c37632e authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Support for adding "tags" in SAML 2.0 metadata Extensions

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1085 44740490-163a-0410-bde0-09ae8108e29a
parent e6fcd7fe
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,8 @@
*/
class SimpleSAML_Metadata_SAMLBuilder {
/**
* The DOMDocument we are working in.
*/
......@@ -68,6 +70,24 @@ class SimpleSAML_Metadata_SAMLBuilder {
}
private function addExtensions($metadata) {
$extensions = $this->createElement('Extensions');
# $extensions->setAttribute('xmlns:saml', 'urn:oasis:names:tc:SAML:2.0:assertion');
if (array_key_exists('tags', $metadata)) {
$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));
}
$extensions->appendChild($attr);
}
$this->entityDescriptor->appendChild($extensions);
}
private function addOrganizationInfo($metadata) {
if (array_key_exists('name', $metadata)) {
......@@ -156,6 +176,9 @@ class SimpleSAML_Metadata_SAMLBuilder {
$e = $this->createElement('SPSSODescriptor');
$e->setAttribute('protocolSupportEnumeration', 'urn:oasis:names:tc:SAML:2.0:protocol');
$this->addExtensions($metadata);
$this->addCertificate($e, $metadata);
......@@ -476,10 +499,10 @@ class SimpleSAML_Metadata_SAMLBuilder {
* @param string $name The name of the DOMElement.
* @return DOMElement The new DOMElement.
*/
private function createElement($name) {
private function createElement($name, $ns = 'urn:oasis:names:tc:SAML:2.0:metadata') {
assert('is_string($name)');
return $this->document->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', $name);
assert('is_string($ns)');
return $this->document->createElementNS($ns, $name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment