OAuth WRAP : Rich App Profile仕様メモ(特に新しい情報はなし)

大先輩のエントリでtowrap!が紹介されました。
みなさんも使ってみてください。https://r-weblife.sakura.ne.jp/towrap/

で、Web App Profileが動いているっぽい感じになったので、次はRich App Profileを実装したいなーと思っております。
仕様はこちら。draft-hardt-oauth-01 - OAuth Web Resource Authorization Profiles
前のエントリと内容が変わっているのでもう一度確認。

Client Directs the User to the Authorization Server

  • wrap_client_id(必須)
  • wrap_callback(オプション)
  • wrap_client_state(オプション)
  • wrap_scope(オプション)
  • Additional parameters

これは、Web App Profileとほぼ同じです。
wrap_callbackがオプションになっとります。

Applications with Callback URLs

Callback URLを持っている場合のユーザー同意後の処理は、callback_urlに以下のパラメータをつけて返します。

  • wrap_verification_code
  • wrap_client_state
  • Additional parameters

ユーザーが同意しなかったらこんな感じ。

  • user_denied

これまた、Web App Profileと同じです。

Applications without Callback URLs

次に、Callback URLを持っていない場合。

The Server MAY also append the Verification Code to the title of the
HTML page so that Clients that have access to the title of the
browser's current page can obtain the Verification Code without
requiring the User enter the Verification Code into the Client. The
Client can parse the title looking for "code=" and then the rest of
the title is the Verification Code. If adding the Verification Code
to the title of the HTML page, the Server MUST also include the
wrap_client_state parameter if sent from the Client as the "state="
parameter.

んー。この辺はもう少し見守ろう。。。

Client Requests Access Token

  • wrap_client_id
  • wrap_verification_code
  • Additional parameters

Web App Profileと違うところは、wrap_client_secretとwrap_callbackが不要なとこですね。

Successful/Unsuccessful Access Token Response from Authorization Server

Web App Profileと同じ。

Client Refreshes Access Token

  • wrap_refresh_token

あれ?wrap_client_idも不要ですか。まぁ、client_idは認可時にばればれなのでsecret使わないならいらないか。

まとめ

callback必須ならWeb App Profileから必須パラメータを減らすだけでできそう。
これ実装すればJavaScriptを実行するHTMLの配置だけで使えるFacebook ConnectのComment Widgetみたいなことができそうです。

そういえば、よく仕様の中に出てくるSimple Web Token (SWT) と JSON Web Token (JWT)についてまとめたいって思っていたのを思い出した。
また今度。