From b9e02f34a950d32a0fe65cbf73459e3dec27afc1 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 19 Aug 2009 06:15:35 +0000
Subject: [PATCH] SimpleSAML_XML_Shib13/AuthnRequest: Remove $configuratio nand
 $metadatastore parameters from constructor.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1689 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/XML/Shib13/AuthnRequest.php | 18 +++++++++---------
 www/shib13/sp/initSSO.php                  |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
index 428aa6064..3426375af 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
@@ -10,7 +10,6 @@
  */
 class SimpleSAML_XML_Shib13_AuthnRequest {
 
-	private $configuration = null;
 	private $metadata = null;
 	
 	private $issuer = null;
@@ -23,9 +22,7 @@ class SimpleSAML_XML_Shib13_AuthnRequest {
 	const PROTOCOL = 'shib13';
 
 
-	function __construct(SimpleSAML_Configuration $configuration, SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore) {
-		$this->configuration = $configuration;
-		$this->metadata = $metadatastore;
+	function __construct() {
 		
 		$this->requestid = SimpleSAML_Utilities::generateID();
 	}
@@ -76,16 +73,19 @@ class SimpleSAML_XML_Shib13_AuthnRequest {
 	}
 
 	
-	public function createRedirect($destination) {
-		$idpmetadata = $this->metadata->getMetaData($destination, 'shib13-idp-remote');
-		$spmetadata = $this->metadata->getMetaData($this->getIssuer(), 'shib13-sp-hosted');
-	
+	public function createRedirect($destination, $shire = NULL) {
+		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
+		$idpmetadata = $metadata->getMetaData($destination, 'shib13-idp-remote');
+
+		if ($shire === NULL) {
+			$shire = $metadata->getGenerated('AssertionConsumerService', 'shib13-sp-hosted');
+		}
+
 		if (!isset($idpmetadata['SingleSignOnService'])) {
 			throw new Exception('Could not find the SingleSignOnService parameter in the Shib 1.3 IdP Remote metadata. This parameter has changed name from an earlier version of simpleSAMLphp, when it was called SingleSignOnUrl. Please check your shib13-sp-remote.php configuration the IdP with entity id ' . $destination . ' and make sure the SingleSignOnService parameter is set.');
 		}
 		
 		$desturl = $idpmetadata['SingleSignOnService'];
-		$shire = $this->metadata->getGenerated('AssertionConsumerService', 'shib13-sp-hosted');
 		$target = $this->getRelayState();
 		
 		$url = $desturl . '?' .
diff --git a/www/shib13/sp/initSSO.php b/www/shib13/sp/initSSO.php
index 3a3b185ec..e538e28fb 100644
--- a/www/shib13/sp/initSSO.php
+++ b/www/shib13/sp/initSSO.php
@@ -67,7 +67,7 @@ if (!isset($session) || !$session->isValid('shib13') ) {
 	
 	
 	try {
-		$ar = new SimpleSAML_XML_Shib13_AuthnRequest($config, $metadata);
+		$ar = new SimpleSAML_XML_Shib13_AuthnRequest();
 		$ar->setIssuer($spentityid);	
 		if(isset($_GET['RelayState'])) 
 			$ar->setRelayState($_GET['RelayState']);
-- 
GitLab