From 08ee35cf7ea96bfc7ea11b238081f3e1661418c7 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Mon, 13 Jul 2009 06:20:11 +0000 Subject: [PATCH] authsource-example: Simple display of received exception. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1581 44740490-163a-0410-bde0-09ae8108e29a --- www/example-simple/authsource-example.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/www/example-simple/authsource-example.php b/www/example-simple/authsource-example.php index 17854da3d..631542d54 100644 --- a/www/example-simple/authsource-example.php +++ b/www/example-simple/authsource-example.php @@ -14,6 +14,21 @@ if(array_key_exists('logout', $_REQUEST)) { SimpleSAML_Auth_Default::initLogout('/' . $config->getBaseURL() . 'logout.php'); } +if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) { + /* This is just a simple example of an error. */ + + $state = SimpleSAML_Auth_State::loadExceptionState(); + 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); +} + if(!array_key_exists('as', $_REQUEST)) { throw new Exception('No authentication source chosen.'); } @@ -21,7 +36,7 @@ if(!array_key_exists('as', $_REQUEST)) { $as = $_REQUEST['as']; if (!$session->isValid($as)) { - SimpleSAML_Auth_Default::initLogin($as, SimpleSAML_Utilities::selfURL()); + SimpleSAML_Auth_Default::initLogin($as, SimpleSAML_Utilities::selfURL(), SimpleSAML_Utilities::selfURL()); } $attributes = $session->getAttributes(); -- GitLab