From 6d64882270aa3dda3cb184d848692123e552ef1e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 4 Aug 2009 06:43:26 -0400 Subject: OpenIDPlugin sets up actions for router --- plugins/OpenID/OpenIDPlugin.php | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 plugins/OpenID/OpenIDPlugin.php (limited to 'plugins/OpenID') diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php new file mode 100644 index 000000000..149a92356 --- /dev/null +++ b/plugins/OpenID/OpenIDPlugin.php @@ -0,0 +1,78 @@ +. + * + * @category Plugin + * @package Laconica + * @author Evan Prodromou + * @copyright 2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +/** + * Plugin for OpenID authentication and identity + * + * This class enables consumer support for OpenID, the distributed authentication + * and identity system. + * + * @category Plugin + * @package Laconica + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + * @link http://openid.net/ + */ + +class OpenIDPlugin extends Plugin +{ + /** + * Initializer for the plugin. + */ + + function __construct() + { + parent::__construct(); + } + + /** + * Add OpenID-related paths to the router table + * + * Hook for RouterInitialized event. + * + * @return boolean hook return + */ + + function onRouterInitialized(&$m) + { + $m->connect('main/openid', array('action' => 'openidlogin')); + $m->connect('settings/openid', array('action' => 'openidsettings')); + $m->connect(':nickname/xrds', + array('action' => 'xrds'), + array('nickname' => '[a-zA-Z0-9]{1,64}')); + $m->connect('xrds', array('action' => 'publicxrds')); + $m->connect('index.php?action=finishopenidlogin', array('action' => 'finishopenidlogin')); + $m->connect('index.php?action=finishaddopenid', array('action' => 'finishaddopenid')); + + return true; + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf