From 8954a20ff17b8dfb54c2495e290a65e6e81b11c2 Mon Sep 17 00:00:00 2001
From: Hans Zandbelt <hans.zandbelt@surfnet.nl>
Date: Fri, 12 Dec 2008 16:25:33 +0000
Subject: [PATCH] add support for dynamically generated WS-Fed realm/entity
 identifiers

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1064 44740490-163a-0410-bde0-09ae8108e29a
---
 .../Metadata/MetaDataStorageHandlerFlatFile.php |  2 ++
 metadata-templates/wsfed-sp-hosted.php          | 17 ++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
index 9788963e3..a220043b8 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php
@@ -140,6 +140,8 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile extends SimpleSAML_Meta
 			return $baseurl . 'shib13/idp/metadata.php';
 		} elseif($set === 'shib13-sp-hosted') {
 			return $baseurl . 'shib13/sp/metadata.php';
+		} elseif($set === 'wsfed-sp-hosted') {
+			return 'urn:federation:' . SimpleSAML_Utilities::getSelfHost();
 		} else {
 			throw new Exception('Can not generate dynamic EntityID for metadata of this type: [' . $set . ']');
 		}
diff --git a/metadata-templates/wsfed-sp-hosted.php b/metadata-templates/wsfed-sp-hosted.php
index 04b082ee6..238f33a13 100644
--- a/metadata-templates/wsfed-sp-hosted.php
+++ b/metadata-templates/wsfed-sp-hosted.php
@@ -1,9 +1,20 @@
 <?php
+/* 
+ * WS-Federation Meta data for simpleSAMLphp
+ *
+ * The WS-Federation SP Hosted config is used by the WS-Federation SP to identify itself.
+ *
+ * Required fields:
+ *  - host
+ */
 
 $metadata = array( 
-	'urn:federation:simplesamlphp:localhost' => array(
-		'host' => 'localhost',
-	),
+	/*
+	 * Example of a hosted SP 
+	 */
+	'__DYNAMIC:1__' => array(
+		'host'  => '__DEFAULT__'
+	)
 );
 
 ?>
-- 
GitLab