From 56d3a18cba85e44c527eea85dbf013a133c9169f Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 3 Mar 2009 08:20:34 +0000
Subject: [PATCH] Add name and description to generated metadata.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1364 44740490-163a-0410-bde0-09ae8108e29a
---
 www/saml2/idp/metadata.php  | 11 +++++++++--
 www/saml2/sp/metadata.php   | 10 +++++++++-
 www/shib13/idp/metadata.php | 11 +++++++++--
 www/shib13/sp/metadata.php  |  9 +++++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 6d402781d..77355811b 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -39,8 +39,6 @@ try {
 	$urlSLOr = $metadata->getGenerated('SingleLogoutServiceResponse', 'saml20-idp-hosted', array('logouttype' => $logouttype));
 
 	$metaArray = array(
-		'name' => 'Type in a name for this entity',
-		'description' => 'and a proper description that would help users know when to select this IdP.',
 		'SingleSignOnService' => $metadata->getGenerated('SingleSignOnService', 'saml20-idp-hosted', array()),
 		'SingleLogoutService' => $metadata->getGenerated('SingleLogoutService', 'saml20-idp-hosted', array('logouttype' => $logouttype)),
 		'SingleLogoutServiceResponse'  => $metadata->getGenerated('SingleLogoutServiceResponse', 'saml20-idp-hosted', array('logouttype' => $logouttype)),
@@ -56,6 +54,15 @@ try {
 	} else {
 		$metaArray['NameIDFormat'] = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient';
 	}
+	if (array_key_exists('name', $idpmeta)) {
+		$metaArray['name'] = $idpmeta['name'];
+	}
+	if (array_key_exists('description', $idpmeta)) {
+		$metaArray['description'] = $idpmeta['description'];
+	}
+	if (array_key_exists('url', $idpmeta)) {
+		$metaArray['url'] = $idpmeta['url'];
+	}
 
 
 	$metaflat = var_export($idpentityid, TRUE) . ' => ' . var_export($metaArray, TRUE) . ',';
diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php
index e62de3c8e..ed84a00a3 100644
--- a/www/saml2/sp/metadata.php
+++ b/www/saml2/sp/metadata.php
@@ -36,7 +36,15 @@ try {
 	} else {
 		$metaArray['NameIDFormat'] = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient';
 	}
-
+	if (array_key_exists('name', $spmeta)) {
+		$metaArray['name'] = $spmeta['name'];
+	}
+	if (array_key_exists('description', $spmeta)) {
+		$metaArray['description'] = $spmeta['description'];
+	}
+	if (array_key_exists('url', $spmeta)) {
+		$metaArray['url'] = $spmeta['url'];
+	}
 
 	$certInfo = SimpleSAML_Utilities::loadPublicKey($spmeta);
 	if ($certInfo !== NULL && array_key_exists('certData', $certInfo)) {
diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php
index 624ab6113..99bfd3647 100644
--- a/www/shib13/idp/metadata.php
+++ b/www/shib13/idp/metadata.php
@@ -33,8 +33,6 @@ try {
 	}
 
 	$metaArray = array(
-		'name' => 'Type in a name for this entity',
-		'description' => 'and a proper description that would help users know when to select this IdP.',
 		'SingleSignOnService' => $metadata->getGenerated('SingleSignOnService', 'shib13-idp-hosted'),
 		'certFingerprint' => $certFingerprint,
 	);
@@ -44,6 +42,15 @@ try {
 	} else {
 		$metaArray['NameIDFormat'] = 'urn:mace:shibboleth:1.0:nameIdentifier';
 	}
+	if (array_key_exists('name', $idpmeta)) {
+		$metaArray['name'] = $idpmeta['name'];
+	}
+	if (array_key_exists('description', $idpmeta)) {
+		$metaArray['description'] = $idpmeta['description'];
+	}
+	if (array_key_exists('url', $idpmeta)) {
+		$metaArray['url'] = $idpmeta['url'];
+	}
 
 
 	$metaflat = var_export($idpentityid, TRUE) . ' => ' . var_export($metaArray, TRUE) . ',';
diff --git a/www/shib13/sp/metadata.php b/www/shib13/sp/metadata.php
index 4e10cffc9..d9cda1877 100644
--- a/www/shib13/sp/metadata.php
+++ b/www/shib13/sp/metadata.php
@@ -41,6 +41,15 @@ try {
 	} else {
 		$metaArray['NameIDFormat'] = 'urn:mace:shibboleth:1.0:nameIdentifier';
 	}
+	if (array_key_exists('name', $spmeta)) {
+		$metaArray['name'] = $spmeta['name'];
+	}
+	if (array_key_exists('description', $spmeta)) {
+		$metaArray['description'] = $spmeta['description'];
+	}
+	if (array_key_exists('url', $spmeta)) {
+		$metaArray['url'] = $spmeta['url'];
+	}
 
 
 	$metaflat = var_export($spentityid, TRUE) . ' => ' . var_export($metaArray, TRUE) . ',';
-- 
GitLab