04WebFinger的利用 | 02.技术预研 | Social

04-WebFinger的利用

郑昀 201005 隶属于《02.技术预研》小节

Kuber 的 SocialBadge 还利用了 WebFinger ,从而可以根据用户输入的 Email 地址获取它的关联信息。当然 Kuber 还是走 Social Graph 来得到关联信息,因为 WebFinger 的数据能被 Social Graph 调用。

什么是 WebFinger ?

Finger 是个UNIX指令,在Unix系统下输入 finger email@domainname.com 就可以知道和该Email账户相关的信息。可以理解为Finger 指令是在网络发展初期,用Email帐号来作为每个网民的网上身份证的一种尝试。

WebFinger 的目的是什么呢?那就是通过使用户能将元数据信息附加其中,从而让现存的Email地址更具价值。元数据包括如下内容:
    * 想要公开的个人资料
    * 指向ID提供商的链接(比如 OpenID server)
    * 公共密匙
    * 以此Email地址为ID的其他服务 (比如 Flickr, Picasa, Smugmug, Twitter, Facebook的所有服务的用户名)
    * 指向一个网络身份的URL地址
    * 个人数据资料 (昵称,姓名等)
    * 甚或是一个不包含公共元数据的,但仅仅包含一个指向包含元数据终端的链接。

Google推出WebFinger的目的,就是要让你的email更有用,使之成为一种以email为中心的OpenID。

WebFinger 现已融入 Google 各种 Social API

可以在Buzz API Doc里发现 WebFinger 的踪影。Buzz API FAQ里说道:计划引入『distributed profile and contact information with WebFinger』。Google的人也说过:『

We've now enabled WebFinger for all gmail/google profiles with public profiles.

Google Webfinger 的查询地址是:

http://www.google.com/s2/webfinger/?q=acct%3Azhengyun%40gmail.com

即传入关键词为:“acct:foo@example.com”。acct 代表 account

上面这个查询的返回是:

<?xml version='1.0'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
    <Subject>acct:zhengyun@gmail.com</Subject>
    <Alias>http://www.google.com/profiles/zhengyun</Alias>
    <Link rel='http://portablecontacts.net/spec/1.0' href='http://www-opensocial.googleusercontent.com/api/people/'/>
    <Link rel='http://portablecontacts.net/spec/1.0#me' href='http://www-opensocial.googleusercontent.com/api/people/110589389080388532670/'/>
    <Link rel='http://webfinger.net/rel/profile-page' href='http://www.google.com/profiles/zhengyun' type='text/html'/>
    <Link rel='http://microformats.org/profile/hcard' href='http://www.google.com/profiles/zhengyun' type='text/html'/>
    <Link rel='http://gmpg.org/xfn/11' href='http://www.google.com/profiles/zhengyun' type='text/html'/>
    <Link rel='http://specs.openid.net/auth/2.0/provider' href='http://www.google.com/profiles/zhengyun'/>
    <Link rel='describedby' href='http://www.google.com/profiles/zhengyun' type='text/html'/>
    <Link rel='describedby' href='http://s2.googleusercontent.com/webfinger/?q=acct%3Azhengyun%40gmail.com&amp;fmt=foaf' type='application/rdf+xml'/>
    <Link rel='http://schemas.google.com/g/2010#updates-from' href='https://www.googleapis.com/buzz/v1/activities/110589389080388532670/@public' type='application/atom+xml'/>
</XRD>

其中,它返回的

https://www.googleapis.com/buzz/v1/activities/110589389080388532670/@public 就是我的 Google Buzz 公开更新。

Alias节点则是:『The <Alias> element indicates an alternative URI the account might be known as. This would typically be an HTTP profile page, email address (prefixed with a mailto: URI scheme), or another account URI. The first link provides the location of the user’s Portable Contacts service.』所以一般都是对应于用户的Profile地址。

Google 的这个查询入口给了我们一种可能:根据输入的 Email 地址(尤其是Gmail地址),获取他的Profile地址。

原文地址:https://www.cnblogs.com/zhengyun_ustc/p/1744397.html