diff --git a/config/config-template.php b/config/config-template.php index 1f47423124d14887e5c989c54193e5dec8e08a25..cc7e31b563cc86dbd56c07e321a9fa3483114c24 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 c1b05534c25d2c09b56ec1c2f0213098a20dbd5e..69ed8e3e84396dfdf2f85ac4defa7b12285caf75 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 da695d0774b4c99a6a31d2e96b79774ba03f7cb1..7395a6eb03933aa4ce153fcdf132abc9aec864b9 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();