Revision: 1861
Author: olavmrk
Date: Fri Oct 16 04:04:44 2009
Log: SimpleSAML_Auth_Simple: Add getLogoutURL().
http://code.google.com/p/simplesamlphp/source/detail?r=1861
Added:
/trunk/modules/core/www/as_logout.php
Modified:
/trunk/lib/SimpleSAML/Auth/Simple.php
=======================================
--- /dev/null
+++ /trunk/modules/core/www/as_logout.php Fri Oct 16 04:04:44 2009
@@ -0,0 +1,19 @@
+<?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']);
=======================================
--- /trunk/lib/SimpleSAML/Auth/Simple.php Fri Oct 16 04:04:33 2009
+++ /trunk/lib/SimpleSAML/Auth/Simple.php Fri Oct 16 04:04:44 2009
@@ -162,6 +162,32 @@
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;
+ }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---