New plugins:
* LRDD
    LRDD implements client-side RFC6415 and RFC7033 resource descriptor
    discovery procedures. I.e. LRDD, host-meta and WebFinger stuff.
    OStatus and OpenID now depend on the LRDD plugin (XML_XRD).
* WebFinger
    This plugin implements the server-side of RFC6415 and RFC7033. Note:
    WebFinger technically doesn't handle XRD, but we serve both that and
    JRD (JSON Resource Descriptor), depending on Accept header and one
    ugly hack to check for old StatusNet installations.
    WebFinger depends on LRDD.
We might make this even prettier by using Net_WebFinger, but it is not
currently RFC7033 compliant (no /.well-known/webfinger resource GETs).
Disabling the WebFinger plugin would effectively render your site non-
federated (which might be desired on a private site).
Disabling the LRDD plugin would make your site unable to do modern web
URI lookups (making life just a little bit harder).
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Implementation of WebFinger resource discovery (RFC7033)
 | 
						|
 *
 | 
						|
 * @category  Discovery
 | 
						|
 * @package   GNUSocial
 | 
						|
 * @author    Mikael Nordfeldth <mmn@hethane.se>
 | 
						|
 * @copyright 2013 Free Software Foundation, Inc.
 | 
						|
 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
 | 
						|
 * @link      http://status.net/
 | 
						|
 */
 | 
						|
class LRDDMethod_WebFinger extends LRDDMethod
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Simply returns the WebFinger URL over HTTPS at the uri's domain:
 | 
						|
     * https://{domain}/.well-known/webfinger?resource={uri}
 | 
						|
     */
 | 
						|
    public function discover($uri)
 | 
						|
    {
 | 
						|
        if (!Discovery::isAcct($uri)) {
 | 
						|
            throw new Exception('Bad resource URI: '.$uri);
 | 
						|
        }
 | 
						|
        list($user, $domain) = explode('@', parse_url($uri, PHP_URL_PATH));
 | 
						|
        if (!filter_var($domain, FILTER_VALIDATE_IP)
 | 
						|
                && !filter_var(gethostbyname($domain), FILTER_VALIDATE_IP)) {
 | 
						|
            throw new Exception('Bad resource host.');
 | 
						|
        }
 | 
						|
 | 
						|
        $link = new XML_XRD_Element_Link(
 | 
						|
                        Discovery::LRDD_REL,
 | 
						|
                        'https://' . $domain . '/.well-known/webfinger?resource={uri}',
 | 
						|
                        Discovery::JRD_MIMETYPE,
 | 
						|
                        true);  //isTemplate
 | 
						|
 | 
						|
        return array($link);
 | 
						|
    }
 | 
						|
}
 |