From 1ea1aca477616bfa1a34d91fb4b5e6d80b5b8d6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Thu, 4 Sep 2008 13:10:30 +0000
Subject: [PATCH] Adding support for using generateUserIdentifier in shib
 context

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@857 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Utilities.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 5a5ce5b01..daf57e59f 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -941,12 +941,15 @@ class SimpleSAML_Utilities {
 	 * @param $idpEntityId  The entity id of the IdP.
 	 * @param $spEntityId   The entity id of the SP.
 	 * @param $attributes   The attributes of the user.
+	 * @param $idpset       Allows to select another metadata set. (to support both saml2 or shib13)
+	 * @param $sppset       Allows to select another metadata set. (to support both saml2 or shib13)
 	 * @return A non-reversible unique identifier for the user.
 	 */
-	public static function generateUserIdentifier($idpEntityId, $spEntityId, $attributes) {
+	public static function generateUserIdentifier($idpEntityId, $spEntityId, $attributes, $idpset = 'saml20-idp-hosted', $spset = 'saml20-sp-remote') {
+	
 		$metadataHandler = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-		$idpMetadata = $metadataHandler->getMetaData($idpEntityId, 'saml20-idp-hosted');
-		$spMetadata = $metadataHandler->getMetaData($spEntityId, 'saml20-sp-remote');
+		$idpMetadata = $metadataHandler->getMetaData($idpEntityId, $idpset);
+		$spMetadata = $metadataHandler->getMetaData($spEntityId, $spset);
 
 		if(array_key_exists('userid.attribute', $spMetadata)) {
 			$attributeName = $spMetadata['userid.attribute'];
-- 
GitLab