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

openid: Various fixes.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1495 44740490-163a-0410-bde0-09ae8108e29a
parent 4e155f93
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
$oldErrLevel = error_reporting(); $oldErrLevel = error_reporting();
error_reporting($oldErrLevel & ~E_STRICT); error_reporting($oldErrLevel & ~E_STRICT);
#require_once('../../_include.php');
require_once('Auth/OpenID/SReg.php'); require_once('Auth/OpenID/SReg.php');
require_once('Auth/OpenID/Server.php'); require_once('Auth/OpenID/Server.php');
require_once('Auth/OpenID/ServerRequest.php'); require_once('Auth/OpenID/ServerRequest.php');
...@@ -24,17 +23,17 @@ $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthState'], 'openid:state' ...@@ -24,17 +23,17 @@ $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthState'], 'openid:state'
$authState = $_REQUEST['AuthState']; $authState = $_REQUEST['AuthState'];
$authSource = SimpleSAML_Auth_Source::getById($state['openid:AuthId']); $authSource = SimpleSAML_Auth_Source::getById($state['openid:AuthId']);
if ($authSource === NULL) { if ($authSource === NULL) {
throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $state['feide:AuthId'] . '\' - not found.'); throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $state['openid:AuthId'] . '\' - not found.');
} }
function displayError($message) { function displayError($message) {
$error = $message; global $authState;
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid'); $t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
$t->data['msg'] = $msg; $t->data['error'] = $message;
$t->data['error'] = $error; $t->data['AuthState'] = $authState;
$t->show(); $t->show();
} }
...@@ -46,22 +45,6 @@ function getConsumer() { ...@@ -46,22 +45,6 @@ function getConsumer() {
return new Auth_OpenID_Consumer($store); return new Auth_OpenID_Consumer($store);
} }
function getOpenIDURL() {
// Render a default page if we got a submission without an openid
// value.
if (empty($_GET['openid_url'])) {
$error = "Expected an OpenID URL.";
$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
$t->data['msg'] = $msg;
$t->data['error'] = $error;
$t->show();
}
return $_GET['openid_url'];
}
function getReturnTo() { function getReturnTo() {
return SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), return SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(),
array('returned' => '1') array('returned' => '1')
...@@ -76,7 +59,7 @@ function getTrustRoot() { ...@@ -76,7 +59,7 @@ function getTrustRoot() {
function run_try_auth() { function run_try_auth() {
global $authSource; global $authSource;
$openid = getOpenIDURL(); $openid = $_GET['openid_url'];
$consumer = getConsumer(); $consumer = getConsumer();
// Begin the OpenID authentication process. // Begin the OpenID authentication process.
...@@ -190,7 +173,7 @@ function run_finish_auth() { ...@@ -190,7 +173,7 @@ function run_finish_auth() {
if (array_key_exists('returned', $_GET)) { if (array_key_exists('returned', $_GET)) {
run_finish_auth(); run_finish_auth();
} elseif(array_key_exists('openid_url', $_GET)) { } elseif (!empty($_GET['openid_url'])) {
run_try_auth(); run_try_auth();
} else { } else {
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
......
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