Upload
nov-matake
View
2.060
Download
3
Embed Size (px)
DESCRIPTION
Citation preview
OAuth認証再考からの OpenID Connect
@nov
Nov Matake
OpenID Foundation Japan
Evangelist 初号機
OAuth.jp
Idcon
Rubyist
fb_graph, rack-oauth2, openid_connect etc.
「○○ ID でログイン」
ユーザー登録めんどくさい
複数サイトで共通のパスワード
「○○ ID でログイン」
OpenID / OAuth
http://janrain.com/blog/social-login-trends-across-the-web-for-q3-2013/
OAuth 認証 … って言うな …
定義: OAuth 認証
外部サービスが提供する OAuth 1.0/2.0
ベースの “Proprietary” な Profile API を 使ってユーザー認証を行うこと。
Proprietary
GET /me のところを差し替えると他の ID Provider も使える
THE
OAuth 認証の落とし穴
GET /me
User Info
:
GET /me
User Info
:
Weak Point
GET /me
User Info
:
Token Replace
Weak Point
GET /me
User Info
:Different User Data
Token Replace
Weak Point
GET /me
User Info
:
4者目がいる時は注意 !!
見ず知らずの他アプリ向けの Tokenを受けいれてはならない
GET /me
User Info
GET /app
App IDAnother Proprietary
4 API Request
毎ログインごとに
GET /oauth/authorize
POST /oauth/token
GET /app
GET /me
#MA7 Mashup Caravan & Meetup in Kyoto
♥OpenID Connect
OAuth 2.0 + Standardised Identity Layer
ID Token
User Info API
ID Token
認証イベントのアサーション (JSON Web Token)
iss – Issuer
sub – Subject, End-user Identifier
aud – Audience, Client ID
iat - issued at
exp - expiry
誰が (issuer = IdP) 誰を (subject = end-user)
誰のために (audience = client) 認証したのか
ID Token Verification
Verify Signature (RSA-SHA256 etc.)
Verify Claims
iss => Expected IdP ?
aud => Own Client ID ?
iat => Within X mins ?
exp => Future ?
Get “sub”
ID Token
User Info API
ID Token
User Info APIID Token さえあれば認証可能
UserInfo API
OAuth 2.0 対応の API Endpoint
レスポンスフォーマット標準化
ID 連携に必要なプロフィールデータは割と似てる
User ID, 氏名, ニックネーム, 生年月日, 住所 etc.
登録時だけ利用 ?
Discovery & Dynamic Registration
User Centric means Dynamic
developers.facebook.com でアプリ登録
client_id & client_secret をアプリに埋め込む
必要な API Endpoint とレスポンスフォーマットも API
Document 読んで把握
developers.facebook.com でアプリ登録
client_id & client_secret をアプリに埋め込む
必要な API Endpoint とレスポンスフォーマットも API
Document 読んで把握
全部自動化
Discovery
WebFinger (RFC 7033)
GET /.well-known/webfinger?resource=***
OpenID Connect をサポートしてるかどうか
OP Config
GET /.well-known/openid-configuration
OpenID Connect の各 endpoint 等
Dynamic Registration
Client Registration Endpoint (Discoverable)
Standardised Client Metadata
redirect_uris, response_types, grant_types, application_type, client_name, logo_uri etc.
Harder Things? slideshare.net/nat_sakimura/open-id-specificationsworkupdatetokyo2011
openid-foundation-japan.github.com
slideshare.net/matake
github.com/nov
twitter.com/nov