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

SimpleSAML_Auth_Simple: Add getLogoutURL().

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1861 44740490-163a-0410-bde0-09ae8108e29a
parent 3e90f027
No related branches found
No related tags found
No related merge requests found
......@@ -163,6 +163,32 @@ class SimpleSAML_Auth_Simple {
return $login;
}
/**
* Retrieve an URL that can be used to log the user out.
*
* @param string|NULL $returnTo
* The page the user should be returned to afterwards. If this parameter
* is NULL, the user will be returned to the current page.
* @return string
* An URL which is suitable for use in link-elements.
*/
public function getLogoutURL($returnTo = NULL) {
assert('is_null($returnTo) || is_string($returnTo)');
if ($returnTo === NULL) {
$returnTo = SimpleSAML_Utilities::selfURL();
}
$logout = SimpleSAML_Module::getModuleURL('core/as_logout.php');
$logout = SimpleSAML_Utilities::addURLparameter($logout, array(
'AuthId' => $this->authSource,
'ReturnTo' => $returnTo,
));
return $logout;
}
}
?>
\ No newline at end of file
<?php
/**
* Endpoint for logging out in with an authentication source.
*
* @package simpleSAMLphp
* @version $Id$
*/
if (!isset($_REQUEST['ReturnTo']) || !is_string($_REQUEST['ReturnTo'])) {
throw new SimpleSAML_Error_BadRequest('Missing ReturnTo parameter.');
}
if (!isset($_REQUEST['AuthId']) || !is_string($_REQUEST['AuthId'])) {
throw new SimpleSAML_Error_BadRequest('Missing AuthId parameter.');
}
$as = new SimpleSAML_Auth_Simple($_REQUEST['AuthId']);
$as->logout($_REQUEST['ReturnTo']);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment