From 824f3a552508ba00ad638d57bcb7ef68ba325010 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Thu, 16 Apr 2015 18:01:12 +0200 Subject: [PATCH] Move SimpleSAML_Utilities::getAdminLoginURL() to SimpleSAML_Utils_Auth::getAdminLoginURL(). Deprecate the former and stop using it. --- lib/SimpleSAML/Utilities.php | 13 ++----------- lib/SimpleSAML/Utils/Auth.php | 18 ++++++++++++++++++ modules/core/www/frontpage_auth.php | 2 +- modules/core/www/frontpage_config.php | 2 +- modules/core/www/frontpage_federation.php | 2 +- modules/core/www/frontpage_welcome.php | 2 +- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 0a455ac87..7a76d70e9 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -1343,19 +1343,10 @@ class SimpleSAML_Utilities { /** - * Retrieve a admin login URL. - * - * @param string|NULL $returnTo The URL the user should arrive on after admin authentication. - * @return string A URL which can be used for admin authentication. + * @deprecated This function will be removed in SSP 2.0. Please use SimpleSAML_Utils_Auth::getAdminLoginURL instead(); */ public static function getAdminLoginURL($returnTo = NULL) { - assert('is_string($returnTo) || is_null($returnTo)'); - - if ($returnTo === NULL) { - $returnTo = SimpleSAML_Utilities::selfURL(); - } - - return SimpleSAML_Module::getModuleURL('core/login-admin.php', array('ReturnTo' => $returnTo)); + return SimpleSAML_Utils_Auth::getAdminLoginURL($returnTo); } diff --git a/lib/SimpleSAML/Utils/Auth.php b/lib/SimpleSAML/Utils/Auth.php index d9575c018..e8d299993 100644 --- a/lib/SimpleSAML/Utils/Auth.php +++ b/lib/SimpleSAML/Utils/Auth.php @@ -9,6 +9,24 @@ class SimpleSAML_Utils_Auth { + /** + * Retrieve a admin login URL. + * + * @param string|NULL $returnTo The URL the user should arrive on after admin authentication. Defaults to null. + * + * @return string A URL which can be used for admin authentication. + */ + public static function getAdminLoginURL($returnTo = null) + { + assert('is_string($returnTo) || is_null($returnTo)'); + + if ($returnTo === null) { + $returnTo = SimpleSAML_Utilities::selfURL(); + } + + return SimpleSAML_Module::getModuleURL('core/login-admin.php', array('ReturnTo' => $returnTo)); + } + /** * Check whether the current user is admin. * diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php index 324867ef7..a471be784 100644 --- a/modules/core/www/frontpage_auth.php +++ b/modules/core/www/frontpage_auth.php @@ -9,7 +9,7 @@ $session = SimpleSAML_Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utils_Auth::requireAdmin(); } -$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$loginurl = SimpleSAML_Utils_Auth::getAdminLoginURL(); $isadmin = SimpleSAML_Utils_Auth::isAdmin(); diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index ee9dbc1d4..4ec7585af 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -10,7 +10,7 @@ $session = SimpleSAML_Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utils_Auth::requireAdmin(); } -$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$loginurl = SimpleSAML_Utils_Auth::getAdminLoginURL(); $isadmin = SimpleSAML_Utils_Auth::isAdmin(); diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index e640f2188..34d610a31 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -10,7 +10,7 @@ $session = SimpleSAML_Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utils_Auth::requireAdmin(); } -$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$loginurl = SimpleSAML_Utils_Auth::getAdminLoginURL(); $isadmin = SimpleSAML_Utils_Auth::isAdmin(); diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php index 95818c467..ca39d038c 100644 --- a/modules/core/www/frontpage_welcome.php +++ b/modules/core/www/frontpage_welcome.php @@ -9,7 +9,7 @@ $session = SimpleSAML_Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utils_Auth::requireAdmin(); } -$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$loginurl = SimpleSAML_Utils_Auth::getAdminLoginURL(); $isadmin = SimpleSAML_Utils_Auth::isAdmin(); -- GitLab