From ba096ad273619ad17ad12349b1318279dbb9a1a7 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 12 Jun 2008 07:33:02 +0000
Subject: [PATCH] WS-Fed: Update metadata and add WS-Fed metadata to the admin
 metadata overview.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@638 44740490-163a-0410-bde0-09ae8108e29a
---
 metadata-templates/wsfed-idp-remote.php  |  3 +--
 metadata-templates/wsfed-sp-hosted.php   |  3 +--
 templates/default/admin-metadatalist.php |  5 +++++
 www/admin/metadata.php                   | 23 +++++++++++++++++++++++
 4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/metadata-templates/wsfed-idp-remote.php b/metadata-templates/wsfed-idp-remote.php
index b7c11596a..5bfd3627e 100644
--- a/metadata-templates/wsfed-idp-remote.php
+++ b/metadata-templates/wsfed-idp-remote.php
@@ -3,9 +3,8 @@
 $metadata = array( 
 
 	'urn:federation:pingfederate:localhost' => array(
-		'host' => 'localhost',
 		'prp' => 'https://localhost:9031/idp/prp.wsf',
-		'cert' => '/cert/pingfed-localhost.pem',
+		'certificate' => 'pingfed-localhost.pem',
 	),	
 );
 
diff --git a/metadata-templates/wsfed-sp-hosted.php b/metadata-templates/wsfed-sp-hosted.php
index d588ba776..04b082ee6 100644
--- a/metadata-templates/wsfed-sp-hosted.php
+++ b/metadata-templates/wsfed-sp-hosted.php
@@ -2,8 +2,7 @@
 
 $metadata = array( 
 	'urn:federation:simplesamlphp:localhost' => array(
-		'host'				=>	'localhost',
-		'realm' => 'urn:federation:simplesamlphp:localhost',
+		'host' => 'localhost',
 	),
 );
 
diff --git a/templates/default/admin-metadatalist.php b/templates/default/admin-metadatalist.php
index ae58901a6..7e4e8471f 100644
--- a/templates/default/admin-metadatalist.php
+++ b/templates/default/admin-metadatalist.php
@@ -114,6 +114,11 @@
 		if (array_key_exists('metadata.shib13-idp-remote', $this->data)) 
 			showEntry('Shib 1.3 Identity Provider (Remote)', $this->data['metadata.shib13-idp-remote'], $this->data['baseurlpath']);
 
+		if (array_key_exists('metadata.wsfed-sp-hosted', $this->data))
+			showEntry('WS-Federation Service Provider (Hosted)', $this->data['metadata.wsfed-sp-hosted'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.wsfed-idp-remote', $this->data))
+			showEntry('WS-Federation Identity Provider (Remote)', $this->data['metadata.wsfed-idp-remote'], $this->data['baseurlpath']);
+
 		
 		?>
 
diff --git a/www/admin/metadata.php b/www/admin/metadata.php
index 248f0685b..d45d53096 100644
--- a/www/admin/metadata.php
+++ b/www/admin/metadata.php
@@ -119,6 +119,29 @@ try {
 		
 	}
 
+	if ($config->getValue('enable.wsfed-sp') === true) {
+		$results = array();
+		$metalist = $metadata->getList('wsfed-sp-hosted');
+		foreach ($metalist AS $entityid => $mentry) {
+			$results[$entityid] = SimpleSAML_Utilities::checkAssocArrayRules($mentry,
+				array('entityid', 'host'),
+				array()
+			);
+		}
+		$et->data['metadata.wsfed-sp-hosted'] = $results;
+
+		$results = array();
+		$metalist = $metadata->getList('wsfed-idp-remote');
+		foreach ($metalist AS $entityid => $mentry) {
+			$results[$entityid] = SimpleSAML_Utilities::checkAssocArrayRules($mentry,
+				array('entityid', 'prp', 'certificate'),
+				array()
+			);
+		}
+		$et->data['metadata.wsfed-idp-remote'] = $results;
+
+	}
+
 	$et->data['header'] = 'Metadata overview';
 	$et->data['icon'] = 'bino.png';
 
-- 
GitLab