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

Move SimpleSAML_Auth_Default::initLogoutReturn() to SimpleSAML_Auth_Source and...

Move SimpleSAML_Auth_Default::initLogoutReturn() to SimpleSAML_Auth_Source and deprecate the former.
parent 4e649e05
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ class SimpleSAML_Auth_Default {
$as = SimpleSAML_Auth_Source::getById($authId);
if ($as === null) {
throw new Exception('Invalid authentication source: ' . $authId);
}
}
$as->initLogin($return, $errorURL, $params);
}
......@@ -47,38 +47,14 @@ class SimpleSAML_Auth_Default {
/**
* 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.
* @param string $authority The authentication source we are logging
* out from.
* @deprecated This method will be removed in SSP 2.0.
*/
public static function initLogoutReturn($returnURL, $authority) {
assert('is_string($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);
if ($as === null) {
throw new Exception('Invalid authentication source: ' . $authority);
}
$as->logout($state);
$as->initLogoutReturn($returnURL);
}
......
......@@ -247,6 +247,35 @@ 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);
}
/**
* Called when logout operation completes.
*
......
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