The future of OpenID 2.0

d:id:ZIGOROu <Toru Yamaguchi>

Cybozu Labs, Inc.

YAPC Asia 2008, May 16, Tokyo, Japan

Agenda

I would like to speak about future of OpenID following this agenda list.

以上のアジェンダに沿って OpenID の未来についてお話します

Terminology 1

Identifier

URI or XRI

URI または XRI

User-Agent

The browser you always used (c.f. IE, Firefox, Safari, Opera...).

あなたがいつも使っているブラウザ

Relying Party (RP)

Web services depends on OpenID Authentication.

OpenID 認証を使っているウェブサービス

Terminology 2

OpenID Provider (OP)

OpenID authentication server managing OP-Local Identifier

OP-Local Identifier を管理している OpenID 認証サーバー

OP EndPoint URL

The URL on OP receiving protocol messages.

プロトコルメッセージを受信する OP 上の URL

OP Identifier

The Identifier specifying OP (c.f. yahoo.com, myopenid.com)

OP を識別する識別子

Terminology 3

Claimed Identifier

The Identifier that end user claimed to own identifier. (c.f. =zigorou, zigorou.myopenid.com)

利用者が自分の識別子であると主張する識別子)

User-Supplied Identifier

Claimed Identifier or OP Identifier. The Identifier actually posted by End User.

Claimed Identifier あるいは OP Identifier。実際に利用者によって送信される識別子。

Terminology 4

OP-Local Identifier

The Identifier provided by OP for End User. This Identifier is locally used, therefore End User may not enable to control it.

(利用者の為に OP によって提供される識別子。この識別子は局所的に使われるので、利用者はその識別子を制御出来ない場合がある。)

Senario Example 1

  1. End User posts their User-Supplied Identifier using login form on the RP.

    利用者は自らの User-Supplied IdentifierRP 上にあるログインフォームで送信します。

    On this example, End User posts "zigorou.example.org" as their Identifier.

    この例では、利用者は "zigorou.art-code.org" を Identifier として使うものとします。

  2. The RP discoverys informaction related User-Supplied Identifier like, OP EndPoint URL, OP-Local Identifier if necessary, from User-Supplied Identifier.

    RPUser-Supplied Identifier からそれに関連する情報である、OP EndPoint URL、必要であれば OP-Local Identifier を見つけます

    On this example, discovered "http://openid.example.com/server" as OP EndPoint URL, "http://example.com/user/zigorou" as OP-Local Identifier.

    この例では、"http://openid.example.com/server" を OP EndPoint URL、"http://example.com/user/zigorou" を OP-Local Identifier とします。

Senario Example 2

  1. If the RP did'nt has an association handle between itself and OP of End User, then the RP sends requests called "associate" to OP EndPoint URL.

    RPOP との間のアソシエーションハンドルを持っていない場合は、RP は "associate" と呼ばれるリクエストを OP EndPoint URL に対して送ります

  2. The RP sets up url with the value called "checkid_setup" or "checkid_immediate" and sends response with "Location" header, has its url as value, to End User.

    RP は "checkid_setup" または "checkid_immediate" と呼ばれる値を含んだ URL を準備し、そのURLを Location ヘッダに含んだレスポンスを利用者に対して送ります。

Senario Example 3

  1. After the OP received "checkid_*" requests, the OP helps End User, for example user interface, navigation, to verify Claimed Identifier ( or OP-Local Identifier ).

    OP は "checkid_*" なリクエストを受信した後に、Claimed Identifier ( あるいは OP-Local Identifier) の検証を行う為にユーザーインターフェースを表示したり、ナビゲーションを用意すると言った手助けを利用者に対して行います。

  2. The OP verify End User's Claimed Idendifier by some ways like a password authentication, and then the OP redirect with the results to the URL on RP called "openid.return_to" preliminarily specified by RP

    OP は何らかの方法、例えばパスワード認証、によって利用者の Claimed Identifier の検証を終えたら、その結果を予め RP によって指定された "openid.return_to" と呼ばれるキーで指定された RP 上の URL に対して利用者の UA をリダイレクトさせます。

Identifier

Identifier is URI or XRI :

Form

Example:

Login by OpenID

Discovery

The discovery phrase is discoverying information of End User, OP EndPoint URL, OP-Local Identifier. There are three ways of discovery in OpenID Authentication, See below.

ディスカバリフェーズとは、OP EndPoint URL, OP-Local Identifierといった利用者の情報を発見する為のフェーズです。 OpenID 認証におけるディスカバリには下記のように三つの方法があります。

  1. XRDS based discovery
  2. Yadis based discovery
  3. HTML based discovery

Direct and Indirect Communication

There are the following two communication ways transfering messages of OpenID Authentication protocol. All protocol messages are posted to OP EndPoint URL.

OpenID 認証プロトコルのメッセージをやり取りする下記の二つの方法があります。 全てのプロトコルメッセージは OP EndPoint URL に送信します。

Direct Communication

The RP tranfers messages to OP directly using http "POST" method.

RPOP に対して直接メッセージを http の "POST" メソッドを使って送信します。

Indirect Communication

The RP transfers messages to OP through User-Agent requested redirection using http "GET" method.

RPOP に対してリダイレクト要求された User-Agent を介して、http の "GET" メソッドを使ってメッセージを送信します。

Data Format

OpenID Authentication protocol messages is formated by Key-Value form encoding.

OpenID 認証プロトコルのメッセージは キー-値を対にしたフォームエンコーディング形式です。

use strict;
use warnings;
use URI;

my $openid_ns = URI->new("http://specs.openid.net/auth/2.0");
my $end_point = URI->new("http://openid.example.com/server");
my $request = $end_point->clone;
$request->query_form({
    'openid.mode' => 'associate',
    'openid.ns' => $openid_ns,
});

print $request->query;
# openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=associate
        

4 Request Modes

assosiate

The mode exchanging shared secret between RP and OP

RP - OP 間で共有鍵の交換を行うモードです。

checkid_setup/checkid_immediate

The mode requesting authentication through User-Agent

User-Agent を介して認証要求を行うモードです。

check_authentication

The mode verifying signature from RP to OP using Direct Communication.

RP から OP に対して Direct Communication によって署名の検証を行うモードです。

Association 1

The association mode is exchanging shared secret for DH key exchange between RP and OP.

association モードはDH鍵共有の為の共通鍵を RP-OP 間で交換する為の物です。

use strict;
use warnings;
use Crypt::DH;
use Text::SimpleTable;

sub create_dh {
  my $dh = Crypt::DH->new( p => 8995127215884267541995034125870655, g => 2 );
  $dh->generate_keys;
  $dh;
}

my $rp_dh = create_dh();
my $op_dh = create_dh();

my $table = Text::SimpleTable->new([20 => 'item'], [36 => 'RP'], [36 => 'OP']);
$table->row('pub', $rp_dh->pub_key, $op_dh->pub_key);
$table->row('pri', $rp_dh->priv_key, $op_dh->priv_key);
$table->row('shared sec', $rp_dh->compute_secret($op_dh->pub_key), $op_dh->compute_secret($rp_dh->pub_key));

print $table->draw;
        

Association 2

Previous page example's result:

.----------------------+--------------------------------------+--------------------------------------.
| item                 | RP                                   | OP                                   |
+----------------------+--------------------------------------+--------------------------------------+
| pub                  | 2467835628736959010041520883499008   | 753006574613379789517619654033408    |
| pri                  | 1020569182109152379992026171549303   | 3902597265081260507940401601978883   |
| shared sec           | 818269593420807859506109126541312    | 818269593420807859506109126541312    |
'----------------------+--------------------------------------+--------------------------------------'
        

Both of RP's shared sec and OP's shared sec is equivalent values.

checkid_(setup|immediate) modes

The "checkid_*" modes is requesting authentication to OP.

"checkid_*" モードは OP に認証要求を行う物です。

checkid_setup

Requesting authentication to OP with UI transition. End User would be authenticated by OP.

画面遷移のある認証要求です。利用者は OP によって認証されます。

checkid_immediate

If End User permits to return authentication result to this RP and has been log in, RP would retrieve authentication result immediatelly. AJAX style (using iframe) is used on this mode. So there is no UI transition.

利用者が認証結果を返す事を許可していてログイン済みならば、RP は認証結果を直ちに取得出来ます。このモードは (iframeを使った) AJAX スタイルで使われます。つまり画面遷移がありません。

The order of discovery

Following rules do discover information around End User.

下記のルールに従って利用者の情報をディスカバリします。

  1. If an Identifier is XRI, do discover using XRDS Resolution.

    IdentifierXRI ならば、XRDS Resolution を用いたディスカバリを行います。

  2. If an Identifier is URI, do discover using Yadis Discovery.

    IdentifierURI ならば、Yadis Discovery を用いたディスカバリを行います。

  3. The both ways is not succeed, do discover using HTML based.

    いずれも上手くいかなかった場合、HTMLベースのディスカバリを行います。

XRDS based discovery 1

In the initiation pharse before discovery, If an Identifier is started with XRI Global Context Symbol, "=", "@", "+", "$", "!" charactors, or the prefix of XRI Reference, "(" charactor, or has 'xri://' scheme prefix, an Identifier should be treated as XRI

ディスカバリの前にある初期化フェーズにおいて、Identifier が "=", "@", "+", "$", "!" で表される XRI Global Context Symbol であるか、XRI Reference の接頭辞である "(" か、あるいは "xri://" スキームを持つ場合は、IdentifierXRI として取り扱うべきです。

It is called QXRI removed XRI scheme, 'xri://', from XRI.

XRI から XRI スキーム 'xri://' を除いた物を QXRI と言います。

XRDS based discovery 2

XRDS based discovery is using XRI resolver. Following ABNF format:

XRDS ベースのディスカバリは XRI リゾルバを用います。下記のような ABNF 形式です。

HXRI               = proxy-resolver "/" QXRI
proxy-resolver     = ( "http://" / "https://" ) proxy-reg-name
proxy-reg-name     = "xri." ireg-name
QXRI               = xri-hier-part [ "?" i-query ]

Now using "http://xri.net" as proxy-resolver.

今回は "http://xri.net" を proxy-resolver として使います。

XRDS based discovery 3

#!/usr/bin/perl

use strict;
use warnings;

use URI;
use LWP::UserAgent;
use HTTP::Request;

my $resolver = URI->new('http://xri.net/');
my $qxri = $ARGV[0];

my $hxri = $resolver->clone;
$hxri->path($qxri);
$hxri->query_form( _xrd_r => 'application/xrds+xml' );

my $lwp = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $hxri);
$req->header('Accept' => 'application/xrds+xml');

my $res = $lwp->request($req);

print $res->content if ($res->is_success);
        

XRDS based discovery 4

This example is using XRI::Resolution::Lite developed by myself.

この例では私が作った XRI::Resolution::Lite を使っています。

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dump qw(dump);
use XRI::Resolution::Lite;
use XML::LibXML::XPathContext;

my $r = XRI::Resolution::Lite->new;
my $xrds = $r->resolve('=zigorou');

my $xpc = XML::LibXML::XPathContext->new($xrds);
$xpc->registerNs('xri', 'xri://$xrd*($v*2.0)');

my @uri = $xpc->findnodes(q|//xri:Type[text()="http://openid.net/signon/1.0"]/ancestor::xri:Service/xri:URI|);

print dump(map { $_->textContent() } @uri);

Correctly you must process to consider 'priority' attribute value of 'Service' element.

正しくは 'Service' 要素の 'priority' 属性を考慮して処理しなければなりません。

priority attribute order

  1. The application should select 'Service' element with the lowest numeric value of priority attribute value.

    アプリケーションは Service 要素の attribute 属性の値として最も小さな数値を持つ物を選ぶべきです。

  2. If an element has no priority attribute, the application should treat lowest priority value.

    priority 属性を持たない場合は最も低い優先度として扱うべきです。

Yadis based discovery

Yadis discovery is same as XRDS based discovery that is returned XRDS document.

Yadis discovery は 結果的に XRDS 文書が返って来るという点で XRDS ベースのディスカバリと同じです。

Accessing the location specified as an Indentifier, It is defferent include meta element or 'x-xrds-location' responce header or document body is XRDS document.

Identifier で示された場所にアクセスした際に meta 要素に含まれるか、レスポンスヘッダで x-xrds-location として示されるか、文書そのものが XRDS 文書かです。

HTML based discovery

Following rules parsing html page of specified Identifier by End User.

下記のルールに従って利用者によって示された Identifier にある html ページを解析します

Discovery rule by OpenID Authentication version
item 1.1 XPath 2.0 XPath
OP EndPoint URL link[@rel="openid.server"]/@href link[@rel="openid2.provider"]/@href
OP-Local Identifier link[@rel="openid.delegate"]/@href link[@rel="openid2.local_id"]/@href

Actually following there are link elements.

実際には下記のような link 要素があります。

<link rel="openid2.provider openid.server" 
      href="http://openid.example.com/server" />
<link rel="openid2.local_id openid.delegate" 
      href="http://example.com/user/zigorou" />

Parse html using Perl

use strict;
use warnings;
use Data::Dump qw(dump);
use URI;
use LWP::UserAgent;
use HTML::TreeBuilder::XPath;

die unless (@ARGV > 0);

my $claimed_id = URI->new($ARGV[0]);
my $ua = LWP::UserAgent->new;
my $res = $ua->get($claimed_id);

die unless ($res->is_success);

my $tree = HTML::TreeBuilder::XPath->new_from_content($res->content);
my @openid = qw(server delegate);
my @openid2 = qw(provider local_id);
my %result;

$result{$_} = $tree->findvalue(sprintf('//link[@rel="openid.%s"]/@href', $_))->value for (@openid);
$result{$_} = $tree->findvalue(sprintf('//link[@rel="openid2.%s"]/@href', $_))->value for (@openid2);

print dump(%result);

5 reasons I won't be getting on the open id train

via 5 reasons I won’t be getting on the open id train

OpenIDにノレない5つの理由から

  1. 99% of implementations are naive
  2. OpenID just doesn’t work for the mobile web
  3. OpenID assumes the internet is full of good-natured human beings
  4. N OpenIDs to rule them all!
  5. It’s less user friendly

1. 99% of implementations are naive

This problem is anyone become OP. We cannot believe anyone's OP.

この問題は誰でも OP になれると言う事です。我々は誰かさんが作った OP を信じる事は出来ません。

This is real. But the specification of OpenID Authentication 2.0 is beginning, so the implementation will make up ground.

これは本当。しかし OpenID 認証 2.0 の仕様は始まったばかりなので、実装はすぐに追いつくでしょう。

We cannot know implementation detail of anyone's OP. So the reputation service is wanted.

誰かさんが作った OP の実装の詳細を知ることは出来ないので、レピュテーションサービスが必要なのです。

2. OpenID just doesn’t work for the mobile web

This problem is OpenID demands mobile End User to type long long Identifier strings. And now most OP is not supported for mobile interface.

この問題は OpenID はモバイルの利用者に長い長い Identifier の文字列を入力させるという事です。

The answer for this problem, It is resolved by using User-Supplied Identifier mechanizm. Inputed OP Identifier as User-Supplied Identifier, End User would only input your account information of OP. So End User is not needed to type long long Identifier strings.

この問題に対する答えは、User-Supplied Identifier と言う仕組みを使えば解決済みです。User-Supplied Identifier として OP Identifier を入力すれば、利用者は OP 上での自分のアカウント情報を入力するだけで済みます。つまり利用者は長い長い Identifier 文字列を入力する必要はありません。

3. OpenID assumes the internet is full of good-natured human beings

It is one of feature on OpenID.

それこそ OpenID の特徴の一つだ。

4. N OpenIDs to rule them all!

Would you please to think not existing OpenID. You must have many Identifier by RP.

OpenID が無かった場合を考えて欲しい。その場合、RP ごとに Identifier を持たねばならないだろう。

5. It's less user friendly

This problem is many steps more than having own authentication system at the point including redirection to OP.

この問題は独自の認証システムを持つ場合よりも OP に対してリダイレクションを含むという点において、ステップが多いという事である。

The solution for this problem, RP would use 'checkid_immediate' mode for authentication. So RP would retrive immediatelly authentication result without UI transition.

この問題の解決方法は、RP が認証の為に 'checkid_immediate' を用いれば良いです。そうすると RP は画面遷移なしに認証結果を直ちに取得出来ます。

ID Recycle

This problem is anyone uses Identifier had not been used.

使われなくなった Identifier を誰かが使うという問題。

In the case of i-name provider (hosting XRI global context), it is not careful. Because XRI designed to avoid such problem by providerd Cannonical ID.

(XRI グローバルコンテキストを管理する) i-name プロバイダの場合は、そのような心配をする必要はありません。XRI は Cannonical ID を提供する事によって、元々そのような問題が起こらないように設計されています。

In the case of OP completelly filled 2.0 specification, is is not careful too. Because instead of Cannonical ID, OP would provide unique strings on URI fragments by user's Identifier.

OP が完全に 2.0 仕様を満たしている場合も心配する必要はありません。Cannonical ID の代わりに、OP は ユーザーの Identifier ごとに URI フラグメントにユニークな文字列を提供してくれるからです。

Using Yadis discovery

Now there are many meta information, but it is not utilized. Using Yadis discovery for Identifier, you certainly can get meta information of End User from XRDS document.

現在多くのメタ情報が使われていますが、それらが有効活用されている訳ではありません。 Yadis ディスカバリを Identifier に対して用いれば、XRDS 文書から利用者のメタ情報を確実に取得出来ます。

This fact indicates to come distributed social network by established Identifier on the WEB.

この事実は Identifier がウェブ上で確立する事によって分散ソーシャルネットワークが実現出来るという事を示唆している。

Contact Service

i-name provider provides i-contact service. It is enable to contact between XRI and XRI.

i-name プロバイダは i-contact サービスを提供しています。それは XRI 間でのコンタクトを可能にしています。

I think to be ported on URI based OpenID Identifier in the future. It will be used just as message service on SNS.

恐らく URI ベースの OpenID Identifier にも将来移植されるのではないかと思っています。ちょうど SNS でのメッセージ機能のように使われると思います。

Future of OpenID

  1. You will know about someone from one Identifier
  2. You will contact to someone from one Identifier
  3. Your friendship relation will be existed on the WEB
  4. Using reputation?

Dive into the world consisting from OpenID!