Skip to content
Snippets Groups Projects
Commit 9b176286 authored by Olav Morken's avatar Olav Morken
Browse files

Auth_Default: Add $authority parameter to logout.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2637 44740490-163a-0410-bde0-09ae8108e29a
parent edd1709e
No related branches found
No related tags found
No related merge requests found
...@@ -137,20 +137,29 @@ class SimpleSAML_Auth_Default { ...@@ -137,20 +137,29 @@ class SimpleSAML_Auth_Default {
* will return if the logout operation does not require a redirect. * 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. * @param string $returnURL The URL we should redirect the user to after logging out.
* @param string|NULL $authority The authentication source we are logging out from, or NULL to log out of the most recent.
*/ */
public static function initLogoutReturn($returnURL) { public static function initLogoutReturn($returnURL, $authority = NULL) {
assert('is_string($returnURL)'); assert('is_string($returnURL)');
assert('is_string($authority) || is_null($authority)');
$session = SimpleSAML_Session::getInstance(); $session = SimpleSAML_Session::getInstance();
$state = $session->getLogoutState(); if ($authority === NULL) {
$authId = $session->getAuthority(); $authority = $session->getAuthority();
$session->doLogout(); if ($authority === NULL) {
/* Already logged out - nothing to do here. */
return;
}
}
$state = $session->getAuthData($authority, 'LogoutState');
$session->doLogout($authority);
$state['SimpleSAML_Auth_Default.ReturnURL'] = $returnURL; $state['SimpleSAML_Auth_Default.ReturnURL'] = $returnURL;
$state['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted'); $state['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted');
$as = SimpleSAML_Auth_Source::getById($authId); $as = SimpleSAML_Auth_Source::getById($authority);
if ($as === NULL) { if ($as === NULL) {
/* The authority wasn't an authentication source... */ /* The authority wasn't an authentication source... */
self::logoutCompleted($state); self::logoutCompleted($state);
...@@ -167,11 +176,13 @@ class SimpleSAML_Auth_Default { ...@@ -167,11 +176,13 @@ class SimpleSAML_Auth_Default {
* never returns. * never returns.
* *
* @param string $returnURL The URL we should redirect the user to after logging out. * @param string $returnURL The URL we should redirect the user to after logging out.
* @param string|NULL $authority The authentication source we are logging out from, or NULL to log out of the most recent.
*/ */
public static function initLogout($returnURL) { public static function initLogout($returnURL, $authority = NULL) {
assert('is_string($returnURL)'); assert('is_string($returnURL)');
assert('is_string($authority) || is_null($authority)');
self::initLogoutReturn($returnURL); self::initLogoutReturn($returnURL, $authority);
/* Redirect... */ /* Redirect... */
SimpleSAML_Utilities::redirect($returnURL); SimpleSAML_Utilities::redirect($returnURL);
......
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