Skip to content
Snippets Groups Projects
Commit 160adde2 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Fixed bug with session creation self::init(). Also made a config option and...

Fixed bug with session creation self::init(). Also made a config option and disabled admin login on the index page on default

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@210 44740490-163a-0410-bde0-09ae8108e29a
parent 8f916728
Branches
Tags v1.2.4
No related merge requests found
...@@ -54,7 +54,8 @@ $config = array ( ...@@ -54,7 +54,8 @@ $config = array (
* This password will give access to the installation page of simpleSAMLphp with * This password will give access to the installation page of simpleSAMLphp with
* metadata listing and diagnostics pages. * metadata listing and diagnostics pages.
*/ */
'auth.adminpassword' => '123', 'auth.adminpassword' => '123',
'admin.protectindexpage' => false,
/* /*
* Enable * Enable
......
...@@ -107,7 +107,7 @@ class SimpleSAML_Session { ...@@ -107,7 +107,7 @@ class SimpleSAML_Session {
* null if not. * null if not.
*/ */
if ($allowcreate) { if ($allowcreate) {
self::init('saml2'); self::init();
return self::$instance; return self::$instance;
} else { } else {
return null; return null;
...@@ -328,7 +328,6 @@ class SimpleSAML_Session { ...@@ -328,7 +328,6 @@ class SimpleSAML_Session {
* Is the session representing an authenticated user, and is the session still alive. * Is the session representing an authenticated user, and is the session still alive.
* This function will return false after the user has timed out. * This function will return false after the user has timed out.
*/ */
public function isValid($authority = null) { public function isValid($authority = null) {
if (!$this->isAuthenticated()) return false; if (!$this->isAuthenticated()) return false;
if (!empty($authority) && ($authority != $this->authority) ) return false; if (!empty($authority) && ($authority != $this->authority) ) return false;
......
...@@ -15,14 +15,19 @@ $config = SimpleSAML_Configuration::getInstance(); ...@@ -15,14 +15,19 @@ $config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getInstance(true); $session = SimpleSAML_Session::getInstance(true);
/* Check if valid local session exists.. */ /* Check if valid local session exists.. */
if (!isset($session) || !$session->isValid('login-admin') ) {
SimpleSAML_Utilities::redirect('/' . $config->getValue('baseurlpath') . 'auth/login-admin.php',
array('RelayState' => SimpleSAML_Utilities::selfURL())
);
}
if ($config->getValue('admin.protectindexpage', false)) {
if (!isset($session) || !$session->isValid('login-admin') ) {
SimpleSAML_Utilities::redirect('/' . $config->getValue('baseurlpath') . 'auth/login-admin.php',
array('RelayState' => SimpleSAML_Utilities::selfURL())
);
}
}
$links = array(); $links = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment