From 6b529186438722868a15c1538151b55768027a3a Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Thu, 2 Jun 2016 10:46:39 +0200
Subject: [PATCH] If we have an exception registered in the state array while
 authenticating, we should throw that exception instead of just printing it as
 plain text and exit. This resolves #401.

---
 modules/core/www/authenticate.php | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php
index 5b97da3db..b6308d36e 100644
--- a/modules/core/www/authenticate.php
+++ b/modules/core/www/authenticate.php
@@ -24,12 +24,7 @@ if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) {
     assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)');
     $e = $state[SimpleSAML_Auth_State::EXCEPTION_DATA];
 
-    header('Content-Type: text/plain');
-    echo "Exception during login:\n";
-    foreach ($e->format() as $line) {
-        echo $line."\n";
-    }
-    exit(0);
+    throw $e;
 }
 
 if (!$as->isAuthenticated()) {
-- 
GitLab