diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php index e2946c0598500210af1b2cce27af07a85bb75fb9..c3c5c07158c5fc055c6ecbd2d22fabc806e2fc90 100644 --- a/lib/SimpleSAML/Auth/Default.php +++ b/lib/SimpleSAML/Auth/Default.php @@ -47,25 +47,48 @@ class SimpleSAML_Auth_Default { * @deprecated This method will be removed in SSP 2.0. */ public static function initLogoutReturn($returnURL, $authority) { - $as = self::getAuthSource($authority); - $as->initLogoutReturn($returnURL); - } + 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); + } + + $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) { - $as = self::getAuthSource($authority); - $as->initLogout($returnURL); + assert('is_string($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) { - 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']); } diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php index 891ac6bc7ffc04923eadf5c7b48a012ada99fe52..9009fb1005c1fdd2234185c8595cc4210d0657b7 100644 --- a/lib/SimpleSAML/Auth/Source.php +++ b/lib/SimpleSAML/Auth/Source.php @@ -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. *