From aa60b1b9ccd7a0a11aafa93850bc4199bd480fd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 2 Oct 2007 14:39:47 +0000
Subject: [PATCH] Adding exception handling in http redirect

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@20 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Bindings/SAML20/HTTPRedirect.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/SimpleSAML/Bindings/SAML20/HTTPRedirect.php b/lib/SimpleSAML/Bindings/SAML20/HTTPRedirect.php
index 64856816f..0d1dc310f 100644
--- a/lib/SimpleSAML/Bindings/SAML20/HTTPRedirect.php
+++ b/lib/SimpleSAML/Bindings/SAML20/HTTPRedirect.php
@@ -40,6 +40,10 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect {
 
 		$md = $this->metadata->getMetaData($remoteentityid, $metadataset);
 		$idpTargetUrl = $md[$endpoint];
+		
+		if (!isset($idpTargetUrl) or $idpTargetUrl == '') {
+			throw new Exception('Could not find endpoint [' .$endpoint  . '] in metadata for [' . $remoteentityid . '] (looking in ' . $metadataset . ')');
+		}
 	
 		$encodedRequest = urlencode( base64_encode( gzdeflate( $request ) ));
 		
-- 
GitLab