3 * Implementation of WebFinger resource discovery (RFC7033)
7 * @author Mikael Nordfeldth <mmn@hethane.se>
8 * @copyright 2013 Free Software Foundation, Inc.
9 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
10 * @link http://status.net/
12 class LRDDMethod_WebFinger extends LRDDMethod
15 * Simply returns the WebFinger URL over HTTPS at the uri's domain:
16 * https://{domain}/.well-known/webfinger?resource={uri}
18 public function discover($uri)
20 if (!Discovery::isAcct($uri)) {
21 throw new Exception('Bad resource URI: '.$uri);
23 list($user, $domain) = explode('@', parse_url($uri, PHP_URL_PATH));
24 if (!filter_var($domain, FILTER_VALIDATE_IP)
25 && !filter_var(gethostbyname($domain), FILTER_VALIDATE_IP)) {
26 throw new Exception('Bad resource host.');
29 $link = new XML_XRD_Element_Link(
31 'https://' . $domain . '/.well-known/webfinger?resource={uri}',
32 Discovery::JRD_MIMETYPE,