Skip to content
Snippets Groups Projects
Commit 704c6dc8 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Take back the migration of SimpleSAML_Auth_Default::initLogout(),...

Take back the migration of SimpleSAML_Auth_Default::initLogout(), initLogoutReturn() and logoutCompleted(), as they are not used anywhere. We'll just deprecate them and remove them in 2.0 then.
parent eed4950a
No related branches found
No related tags found
No related merge requests found
...@@ -47,25 +47,48 @@ class SimpleSAML_Auth_Default { ...@@ -47,25 +47,48 @@ class SimpleSAML_Auth_Default {
* @deprecated This method will be removed in SSP 2.0. * @deprecated This method will be removed in SSP 2.0.
*/ */
public static function initLogoutReturn($returnURL, $authority) { public static function initLogoutReturn($returnURL, $authority) {
$as = self::getAuthSource($authority); assert('is_string($returnURL)');
$as->initLogoutReturn($returnURL); assert('is_string($authority)');
}
$session = SimpleSAML_Session::getSessionFromRequest();
$state = $session->getAuthData($authority, 'LogoutState');
$session->doLogout($authority);
$state['SimpleSAML_Auth_Default.ReturnURL'] = $returnURL;
$state['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted');
$as = SimpleSAML_Auth_Source::getById($authority);
if ($as === NULL) {
/* The authority wasn't an authentication source... */
self::logoutCompleted($state);
}
$as->logout($state);
}
/** /**
* @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML_Auth_Source::initLogout() instead. * @deprecated This method will be removed in SSP 2.0.
*/ */
public static function initLogout($returnURL, $authority) { public static function initLogout($returnURL, $authority) {
$as = self::getAuthSource($authority); assert('is_string($returnURL)');
$as->initLogout($returnURL); assert('is_string($authority)');
self::initLogoutReturn($returnURL, $authority);
\SimpleSAML\Utils\HTTP::redirectTrustedURL($returnURL);
} }
/** /**
* @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML_Auth_Source::logoutCompleted() instead. * @deprecated This method will be removed in SSP 2.0.
*/ */
public static function logoutCompleted($state) { public static function logoutCompleted($state) {
SimpleSAML_Auth_Source::logoutCompleted($state); assert('is_array($state)');
assert('array_key_exists("SimpleSAML_Auth_Default.ReturnURL", $state)');
\SimpleSAML\Utils\HTTP::redirectTrustedURL($state['SimpleSAML_Auth_Default.ReturnURL']);
} }
......
...@@ -247,71 +247,6 @@ abstract class SimpleSAML_Auth_Source ...@@ -247,71 +247,6 @@ abstract class SimpleSAML_Auth_Source
} }
/**
* Start logout.
*
* This function starts a logout operation from the current authentication source. This function will return if the
* logout operation does not require a redirect.
*
* @param string $returnURL The URL we should redirect the user to after logging out. No checking is performed on
* the URL, so make sure to verify it on beforehand if the URL is obtained from user input. Refer to
* \SimpleSAML\Utils\HTTP::checkURLAllowed() for more information.
*/
public function initLogoutReturn($returnURL)
{
assert('is_string($returnURL)');
assert('is_string($authority)');
$session = SimpleSAML_Session::getSessionFromRequest();
$state = $session->getAuthData($this->authId, 'LogoutState');
$session->doLogout($this->authId);
$state['SimpleSAML_Auth_Default.ReturnURL'] = $returnURL;
$state['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted');
$this->logout($state);
self::logoutCompleted($state);
}
/**
* Start logout. This method starts a logout operation from the current authentication source.
*
* This method never returns.
*
* @param string $returnURL The URL we should redirect the user to after logging out. No checking is performed on
* the URL, so make sure to verify it on beforehand if the URL is obtained from user input. Refer to
* \SimpleSAML\Utils\HTTP::checkURLAllowed() for more information.
*/
public function initLogout($returnURL)
{
assert('is_string($returnURL)');
assert('is_string($authority)');
self::initLogoutReturn($returnURL);
\SimpleSAML\Utils\HTTP::redirectTrustedURL($returnURL);
}
/**
* Called when logout operation completes.
*
* This function never returns.
*
* @param array $state The state after the logout.
*/
public static function logoutCompleted($state)
{
assert('is_array($state)');
assert('array_key_exists("SimpleSAML_Auth_Default.ReturnURL", $state)');
\SimpleSAML\Utils\HTTP::redirectTrustedURL($state['SimpleSAML_Auth_Default.ReturnURL']);
}
/** /**
* Complete logout. * Complete logout.
* *
......
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