summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJaime Perez Crespo <jaime.perez@uninett.no>2015-08-30 21:39:32 +0200
committerJaime Perez Crespo <jaime.perez@uninett.no>2015-08-30 21:39:32 +0200
commit634648072090faae743d1fe3cbf01a8d0b9f2775 (patch)
treeb70b173992e3562cae9d635020a0dcab6bd4494a /lib
parent4e649e055ccb051e74ddfbf7bc439b5a3c457c76 (diff)
downloadsimplesamlphp-634648072090faae743d1fe3cbf01a8d0b9f2775.zip
simplesamlphp-634648072090faae743d1fe3cbf01a8d0b9f2775.tar.gz
simplesamlphp-634648072090faae743d1fe3cbf01a8d0b9f2775.tar.bz2
Move SimpleSAML_Auth_Default::initLogoutReturn() to SimpleSAML_Auth_Source and deprecate the former.
Diffstat (limited to 'lib')
-rw-r--r--lib/SimpleSAML/Auth/Default.php34
-rw-r--r--lib/SimpleSAML/Auth/Source.php29
2 files changed, 34 insertions, 29 deletions
diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php
index 76b7f39..ecd5524 100644
--- a/lib/SimpleSAML/Auth/Default.php
+++ b/lib/SimpleSAML/Auth/Default.php
@@ -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);
}
diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php
index 2ad82a7..fc3b9e8 100644
--- a/lib/SimpleSAML/Auth/Source.php
+++ b/lib/SimpleSAML/Auth/Source.php
@@ -248,6 +248,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.
*
* This function never returns.