Skip to content
Snippets Groups Projects
Commit 08ee35cf authored by Olav Morken's avatar Olav Morken
Browse files

authsource-example: Simple display of received exception.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1581 44740490-163a-0410-bde0-09ae8108e29a
parent 7fbb051c
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment