From db20bfafc46f37ba4e653a5725279f6f44c20ec1 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 4 Nov 2009 13:51:24 +0000
Subject: [PATCH] shib13/idp/SSOService.php: Use getMetadataConfig for SP
 metadata.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1942 44740490-163a-0410-bde0-09ae8108e29a
---
 www/shib13/idp/SSOService.php | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php
index ce3267772..7d7b95693 100644
--- a/www/shib13/idp/SSOService.php
+++ b/www/shib13/idp/SSOService.php
@@ -104,7 +104,7 @@ if (isset($_GET['shire'])) {
 
 /* Make sure that the issuer is a valid SP. */
 try {
-	$spmetadata = $metadata->getMetaData($requestcache['Issuer'], 'shib13-sp-remote');
+	$spMetadata = $metadata->getMetaDataConfig($requestcache['Issuer'], 'shib13-sp-remote');
 } catch (Exception $exception) {
 	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSAUTHNREQUEST', $exception);
 }
@@ -140,7 +140,7 @@ if (!$session->isValid($authority) ) {
 	if($authSource) {
 		/* Authenticate with an AuthSource. */
 		$hints = array(
-			'SPMetadata' => $spmetadata,
+			'SPMetadata' => $spMetadata->toArray(),
 			'IdPMetadata' => $idpmetadata,
 		);
 
@@ -161,15 +161,14 @@ if (!$session->isValid($authority) ) {
  * service.
  */
 try {
-	$spmetadata = $metadata->getMetaData($requestcache['Issuer'], 'shib13-sp-remote');
 
 	/* Validate the Shire the response should be sent to. */
 	$shire = $requestcache['shire'];
-	if (!array_key_exists('AssertionConsumerService', $spmetadata)) {
+	if (!$spMetadata->hasValue('AssertionConsumerService')) {
 		throw new Exception('Could not find [AssertionConsumerService] in Shib 1.3 Service Provider remote metadata.');
 	}
 	$foundACS = FALSE;
-	foreach (SimpleSAML_Utilities::arrayize($spmetadata['AssertionConsumerService']) as $acs) {
+	foreach ($spMetadata->getArrayizeString('AssertionConsumerService') as $acs) {
 		if ($acs === $shire) {
 			SimpleSAML_Logger::info('Shib1.3 - IdP.SSOService: Found AssertionConsumerService: '. $acs);
 			$foundACS = TRUE;
@@ -178,7 +177,7 @@ try {
 	}
 	if (!$foundACS) {
 		throw new Exception('Invalid AssertionConsumerService for SP ' .
-			var_export($spmetadata['entityid'], TRUE) . ': ' . var_export($shire, TRUE));
+			var_export($spMetadata->getString('entityid'), TRUE) . ': ' . var_export($shire, TRUE));
 	}
 
 	$attributes = $session->getAttributes();
@@ -186,13 +185,13 @@ try {
 	/* Authentication processing operations. */
 	if (!isset($authProcState)) {
 		/* Not processed. */
-		$pc = new SimpleSAML_Auth_ProcessingChain($idpmetadata, $spmetadata, 'idp');
+		$pc = new SimpleSAML_Auth_ProcessingChain($idpmetadata, $spMetadata->toArray(), 'idp');
 
 		$authProcState = array(
 			'core:shib13-idp:requestcache' => $requestcache,
 			'ReturnURL' => SimpleSAML_Utilities::selfURLNoQuery(),
 			'Attributes' => $attributes,
-			'Destination' => $spmetadata,
+			'Destination' => $spMetadata->toArray(),
 			'Source' => $idpmetadata,
 			);
 
@@ -203,10 +202,10 @@ try {
 
 	/* Generate and send response. */
 	$ar = new SimpleSAML_XML_Shib13_AuthnResponse();
-	$authnResponseXML = $ar->generate($idpmetadata, $spmetadata, $shire, $attributes);
+	$authnResponseXML = $ar->generate($idpmetadata, $spMetadata->toArray(), $shire, $attributes);
 
 	$httppost = new SimpleSAML_Bindings_Shib13_HTTPPost($config, $metadata);
-	$httppost->sendResponse($authnResponseXML, $idpmetadata, $spmetadata, $requestcache['RelayState'], $shire);
+	$httppost->sendResponse($authnResponseXML, $idpmetadata, $spMetadata->toArray(), $requestcache['RelayState'], $shire);
 
 } catch(Exception $exception) {
 	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'GENERATEAUTHNRESPONSE', $exception);
-- 
GitLab