From 6daf0ffe40d554926808657c747a0cfd8092bd0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 4 Apr 2011 06:35:28 +0000
Subject: [PATCH] Fix bug with IdP Discovery script

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2795 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/discojuice/www/discojuice/idpdiscovery.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/discojuice/www/discojuice/idpdiscovery.js b/modules/discojuice/www/discojuice/idpdiscovery.js
index 3e95f89cf..d0c238d39 100644
--- a/modules/discojuice/www/discojuice/idpdiscovery.js
+++ b/modules/discojuice/www/discojuice/idpdiscovery.js
@@ -54,6 +54,10 @@ var IdPDiscovery = function() {
 		
 		"returnTo": function(e) {
 			
+// 			console.log('ReturnTo');
+// 			console.log(e);
+// 			return;
+			
 			var returnTo = query['return'] || null;
 			var returnIDParam = query.returnIDParam || 'entityID';
 			if(!returnTo) {
@@ -65,12 +69,15 @@ var IdPDiscovery = function() {
 				
 				var returnToHost = this.getHostname(returnTo);
 				
-				for (var i = 0; i < returnURLs.length; i++) {
-					if (returnURLs[i] == returnToHost) allowed = true;
+				for (var i = 0; i < this.returnURLs.length; i++) {
+					if (this.returnURLs[i] == returnToHost) allowed = true;
+
 				}
 				
 				if (!allowed) {
 					DiscoJuice.Utils.log('Access denied for return parameter [' + returnToHost + ']');
+					DiscoJuice.Utils.log('Allowed hosts');
+					DiscoJuice.Utils.log(this.returnURLs);
 					return;
 				}
 			}
@@ -79,10 +86,10 @@ var IdPDiscovery = function() {
 				returnTo += '&auth=' + e.auth;
 			}
 			
-			if (!e.entityid) {
+			if (!e.entityID) {
 				window.location = returnTo;
 			} else {
-				window.location = returnTo + '&' + returnIDParam + '=' + escape(e.entityid);
+				window.location = returnTo + '&' + returnIDParam + '=' + escape(e.entityID);
 			}
 			
 			
-- 
GitLab