From c0dc62787d8d6cc1037668a2d909e349e4f867f9 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 12 Oct 2009 06:37:01 +0000
Subject: [PATCH] saml: Restructure code to get correct error message for
 invalid entityID.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1840 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/saml/lib/Auth/Source/SP.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php
index 249bf4310..2421fe654 100644
--- a/modules/saml/lib/Auth/Source/SP.php
+++ b/modules/saml/lib/Auth/Source/SP.php
@@ -47,15 +47,15 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
 		/* Call the parent constructor first, as required by the interface. */
 		parent::__construct($info, $config);
 
-		/* For compatibility with code that assumes that $metadata->getString('entityid') gives the entity id. */
-		if (array_key_exists('entityID', $config)) {
-			$config['entityid'] = $config['entityID'];
-		} else {
-			$config['entityid'] = $this->getMetadataURL();
+		if (!array_key_exists('entityID', $config)) {
+			$config['entityID'] = $this->getMetadataURL();
 		}
 
+		/* For compatibility with code that assumes that $metadata->getString('entityid') gives the entity id. */
+		$config['entityid'] = $config['entityID'];
+
 		$this->metadata = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
-		$this->entityId = $this->metadata->getString('entityid');
+		$this->entityId = $this->metadata->getString('entityID');
 		$this->idp = $this->metadata->getString('idp', NULL);
 		$this->discoURL = $this->metadata->getString('discoURL', NULL);
 	}
-- 
GitLab