From 160adde23109f002b004ebcbbc7ed70d64cced3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Tue, 29 Jan 2008 11:05:49 +0000 Subject: [PATCH] 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 --- config/config-template.php | 3 ++- lib/SimpleSAML/Session.php | 3 +-- www/index.php | 15 ++++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/config/config-template.php b/config/config-template.php index 1f4742312..cc7e31b56 100644 --- a/config/config-template.php +++ b/config/config-template.php @@ -54,7 +54,8 @@ $config = array ( * This password will give access to the installation page of simpleSAMLphp with * metadata listing and diagnostics pages. */ - 'auth.adminpassword' => '123', + 'auth.adminpassword' => '123', + 'admin.protectindexpage' => false, /* * Enable diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index c1b05534c..69ed8e3e8 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -107,7 +107,7 @@ class SimpleSAML_Session { * null if not. */ if ($allowcreate) { - self::init('saml2'); + self::init(); return self::$instance; } else { return null; @@ -328,7 +328,6 @@ class SimpleSAML_Session { * Is the session representing an authenticated user, and is the session still alive. * This function will return false after the user has timed out. */ - public function isValid($authority = null) { if (!$this->isAuthenticated()) return false; if (!empty($authority) && ($authority != $this->authority) ) return false; diff --git a/www/index.php b/www/index.php index da695d077..7395a6eb0 100644 --- a/www/index.php +++ b/www/index.php @@ -15,14 +15,19 @@ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(true); /* 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(); -- GitLab