From 4c10ef35b4ee97cd83d44d8b39eaaf9ea1660a20 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 8 Jul 2010 13:18:33 +0000
Subject: [PATCH] Utilities::getAuthority: Fix misleading error message.

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

diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index ef3197410..3657a5ffa 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -2152,8 +2152,14 @@ class SimpleSAML_Utilities {
 		if (isset($candidates[$idpmetadata['auth']])) {
 			return $candidates[$idpmetadata['auth']];
 		}
-		throw new SimpleSAML_Error_Exception('You need to set \'authority\' in the metadata for ' .
-			var_export($idpmetadata['entityid'], TRUE) . '.');
+		if (strpos($idpmetadata['auth'], '/') !== FALSE) {
+			/* Probably a file. */
+			throw new SimpleSAML_Error_Exception('You need to set \'authority\' in the metadata for ' .
+				var_export($idpmetadata['entityid'], TRUE) . '.');
+		} else {
+			throw new SimpleSAML_Error_Exception('Unknown authsource ' .
+				var_export($idpmetadata['auth'], TRUE) . '.');
+		}
 	}
 
 
-- 
GitLab