]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add OpenID data to the Webfinger XRD file so you can login with it elsewhere
authorEvan Prodromou <evan@status.net>
Wed, 1 Dec 2010 18:43:34 +0000 (13:43 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 1 Dec 2010 18:43:34 +0000 (13:43 -0500)
plugins/OpenID/OpenIDPlugin.php

index cdaabbbf7fd97fa0b7e2adf56508171effece8f2..d5a8c1bf029a450c0bb58d17a933469ec54cba94 100644 (file)
@@ -735,4 +735,29 @@ class OpenIDPlugin extends Plugin
 
         return true;
     }
+
+    /**
+     * Add link in user's XRD file to allow OpenID login.
+     * 
+     * This link in the XRD should let users log in with their
+     * Webfinger identity to services that support it. See
+     * http://webfinger.org/login for an example.
+     *
+     * @param XRD  &$xrd Currently-displaying XRD object
+     * @param User $user The user that it's for
+     * 
+     * @return boolean hook value (always true)
+     */
+
+    function onEndXrdActionLinks(&$xrd, $user)
+    {
+        $profile = $user->getProfile();
+       
+        if (!empty($profile)) {
+            $xrd->links[] = array('rel' => 'http://specs.openid.net/auth/2.0/provider',
+                                  'href' => $profile->profileurl);
+        }
+       
+        return true;
+    }
 }