3 * Laconica, the distributed open-source microblogging tool
7 * LICENCE: This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * @author Evan Prodromou <evan@controlyourself.ca>
23 * @copyright 2009 Control Yourself, Inc.
24 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
25 * @link http://laconi.ca/
28 if (!defined('LACONICA')) {
33 * Plugin for OpenID authentication and identity
35 * This class enables consumer support for OpenID, the distributed authentication
36 * and identity system.
40 * @author Evan Prodromou <evan@controlyourself.ca>
41 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
42 * @link http://laconi.ca/
43 * @link http://openid.net/
46 class OpenIDPlugin extends Plugin
49 * Initializer for the plugin.
52 function __construct()
54 parent::__construct();
58 * Add OpenID-related paths to the router table
60 * Hook for RouterInitialized event.
62 * @return boolean hook return
65 function onRouterInitialized(&$m)
67 $m->connect('main/openid', array('action' => 'openidlogin'));
68 $m->connect('settings/openid', array('action' => 'openidsettings'));
69 $m->connect(':nickname/xrds',
70 array('action' => 'xrds'),
71 array('nickname' => '[a-zA-Z0-9]{1,64}'));
72 $m->connect('xrds', array('action' => 'publicxrds'));
73 $m->connect('index.php?action=finishopenidlogin', array('action' => 'finishopenidlogin'));
74 $m->connect('index.php?action=finishaddopenid', array('action' => 'finishaddopenid'));
79 function onEndLoginGroupNav(&$action)
81 $action_name = $action->trimmed('action');
83 $action->menuItem(common_local_url('openidlogin'),
85 _('Login or register with OpenID'),
86 $action_name === 'openidlogin');
91 function onEndAccountSettingsNav(&$action)
93 $action_name = $action->trimmed('action');
95 $action->menuItem(common_local_url('openidsettings'),
97 _('Add or remove OpenIDs'),
98 $action_name === 'openidsettings');
103 function onAutoload($cls)
107 case 'OpenidloginAction':
108 case 'FinishopenidloginAction':
109 case 'FinishaddopenidAction':
111 case 'PublicxrdsAction':
112 case 'OpenidsettingsAction':
113 require_once(INSTALLDIR.'/plugins/OpenID/' . strtolower(mb_substr($cls, 0, -6)) . '.php');
116 require_once(INSTALLDIR.'/plugins/OpenID/User_openid.php');
123 function onSensitiveAction($action, &$ssl)
127 case 'finishopenidlogin':
128 case 'finishaddopenid':