4 * Public XRDS for OpenID
10 * @author Evan Prodromou <evan@status.net>
11 * @author Robin Millette <millette@status.net>
12 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13 * @link http://status.net/
15 * StatusNet - the distributed open-source microblogging tool
16 * Copyright (C) 2008, 2009, StatusNet, Inc.
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Affero General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Affero General Public License for more details.
28 * You should have received a copy of the GNU Affero General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
36 require_once INSTALLDIR.'/plugins/OpenID/openid.php';
39 * Public XRDS for OpenID
43 * @author Evan Prodromou <evan@status.net>
44 * @author Robin Millette <millette@status.net>
45 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
46 * @link http://status.net/
48 * @todo factor out similarities with XrdsAction
50 class PublicxrdsAction extends Action
55 * @return boolean true
57 function isReadOnly($args)
65 * @param array $args array of arguments
69 function handle($args)
71 parent::handle($args);
72 header('Content-Type: application/xrds+xml');
74 $this->elementStart('XRDS', array('xmlns' => 'xri://$xrds'));
75 $this->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
76 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
78 $this->element('Type', null, 'xri://$xrds*simple');
79 foreach (array('finishopenidlogin', 'finishaddopenid') as $finish) {
80 $this->showService(Auth_OpenID_RP_RETURN_TO_URL_TYPE,
81 common_local_url($finish));
83 $this->elementEnd('XRD');
84 $this->elementEnd('XRDS');
91 * @param string $type XRDS type
92 * @param string $uri URI
93 * @param array $params type parameters, null by default
94 * @param array $sigs type signatures, null by default
95 * @param string $localId local ID, null by default
99 function showService($type, $uri, $params=null, $sigs=null, $localId=null)
101 $this->elementStart('Service');
103 $this->element('URI', null, $uri);
105 $this->element('Type', null, $type);
107 foreach ($params as $param) {
108 $this->element('Type', null, $param);
112 foreach ($sigs as $sig) {
113 $this->element('Type', null, $sig);
117 $this->element('LocalID', null, $localId);
119 $this->elementEnd('Service');