summaryrefslogtreecommitdiff
path: root/plugins/OpenID
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-12-01 13:43:34 -0500
committerEvan Prodromou <evan@status.net>2010-12-01 13:43:34 -0500
commit0410462c4b0a1f99a60a6132f6b08388767381fb (patch)
treeaa70f17bcf2b7be06007c6f1d807698f6e00b7bb /plugins/OpenID
parent86383ecb149578adfeefcf07733616d7fb1f5f13 (diff)
add OpenID data to the Webfinger XRD file so you can login with it elsewhere
Diffstat (limited to 'plugins/OpenID')
-rw-r--r--plugins/OpenID/OpenIDPlugin.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php
index cdaabbbf7..d5a8c1bf0 100644
--- a/plugins/OpenID/OpenIDPlugin.php
+++ b/plugins/OpenID/OpenIDPlugin.php
@@ -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;
+ }
}