From c52c82de19f5ae5d93833deb7ecbd26c72a38a1c Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 1 Oct 2010 11:16:18 +0000
Subject: [PATCH] saml: Add name, description, attributes and
 Organization{Name,DisplayName,URL} to simplesaml-version of the metadata.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2566 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/saml/www/sp/metadata.php | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index 541154d4e..1343c0cfe 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -19,6 +19,11 @@ if (!($source instanceof sspmod_saml_Auth_Source_SP)) {
 $entityId = $source->getEntityId();
 $spconfig = $source->getMetadata();
 
+$metaArray20 = array(
+	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $sourceId),
+	'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId),
+);
+
 $ed = new SAML2_XML_md_EntityDescriptor();
 $ed->entityID = $entityId;
 
@@ -104,6 +109,15 @@ if ($name !== NULL && !empty($attributes)) {
 		$acs->RequestedAttribute[] = $a;
 	}
 
+	$metaArray20['name'] = $name;
+	if ($description !== NULL) {
+		$metaArray20['description'] = $description;
+	}
+
+	$metaArray20['attributes'] = $attributes;
+	if ($nameFormat !== NULL) {
+		$metaArray20['attributes.NameFormat'] = $nameFormat;
+	}
 }
 
 $orgName = $spconfig->getLocalizedString('OrganizationName', NULL);
@@ -122,6 +136,10 @@ if ($orgName !== NULL) {
 	}
 
 	$ed->Organization = $o;
+
+	$metaArray20['OrganizationName'] = $orgName;
+	$metaArray20['OrganizationDisplayName'] = $o->OrganizationDisplayName;
+	$metaArray20['OrganizationURL'] = $o->OrganizationURL;
 }
 
 $c = new SAML2_XML_md_ContactPerson();
@@ -150,10 +168,6 @@ $xml = $ed->toXML();
 SimpleSAML_Utilities::formatDOMElement($xml);
 $xml = $xml->ownerDocument->saveXML($xml);
 
-$metaArray20 = array(
-	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $sourceId),
-	'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId),
-);
 if ($certData !== NULL) {
 	$metaArray20['certData'] = $certData;
 }
-- 
GitLab