the latest specs of openid connect at #idcon 9

46
The Latest Specs of OpenID Connect @ritou 2011/7/8 Identity Conference #9

Upload: ryo-ito

Post on 14-Jul-2015

3.546 views

Category:

Technology


2 download

TRANSCRIPT

The Latest Specs of

OpenID Connect

@ritou

2011/7/8

Identity Conference #9

2

@ritou

• 秋田県在住

• 去年まで某ポータルサイトのログイン担当

•http://d.hatena.ne.jp/ritou• OpenID Connect WG Contributer

はじめに

•情報漏えい騒ぎ

– いまさらPWの使いまわしのリスクに注目

•いまこそOpenID/OAuthの出番?

• OpenID / OAuthへのネガティブな影響

– あるOPのパスワードが漏れたらRP/Clientまで全部やられるね → orz

今こそ安全なAuthN/Zのしくみを提供してアピールすべき!

3

OpenIDとOAuth

• OpenID Auth 2.0

• OpenID v.Next

– Artifact Binding (for

Mobile etc...)

• OAuth 1.0a

• OAuth WRAP

• OAuth 2.0

4

• OpenID OAuth Extension

• OpenID Connect

OpenID Connect

• Authorization : OAuth 2.0 Base

• Authentication

• Attribute transmission

– UserInfo Endpoint

• Discovery– JSON Based

• Dynamic Client Registration

• Session Management– Refresh/Check/Logout 5

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

6

Latest Specs

• Core– http://openid.net/specs/openid-connect-core-1_0.html

• Framework– http://openid.net/specs/openid-connect-framework-

1_0.html

• Discovery– http://openid.net/specs/openid-connect-discovery-

1_0.html

• HTTP Redirect Binding– http://openid.net/specs/openid-connect-http-redirect-

1_0.html7

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

9

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

10

OpenID Connect Discovery

• Endpoint,メタデータをDiscoveryするしくみ

– Endpoints

– サポートしているFlow,Identifierの種類など

• HTTPS + GETでDiscovery用エンドポイントにアクセス

•レスポンスフォーマットはJSONオブジェクト

– XRDよりも簡単!?

11

GET /.well-known/simple-web-discoveryGET /.well-known/simple-web-discovery

OpenID Connect Simple Web Discovery

• Discoveryに利用できるIdentifierは3種類

– Hostname

– Email

– URL

• OpenID Connectの最初の利用例

– Emailアドレスを入力(≒WebFinger)

– OP Identifierを入力(≒OpenID Auth 2.0)

– OpenID URLを入力(≒OpenID Auth 1.1)

12

GET /.well-known/simple-web-discoveryGET /.well-known/simple-web-discovery

OpenID Connect Simple Web Discovery

• Request

GET

/.well-known/simple-web-discovery?

principal= [email protected]&

service=http://openid.net/specs/connect/1.0/issuer

HTTP/1.1

Host: example.com

13

GET /.well-known/simple-web-discoveryGET /.well-known/simple-web-discovery

OpenID Connect Simple Web Discovery

• Response

HTTP/1.1 200 O.K.

Content-Type: application/json

{ "locations":

["https://example.com/auth"]

}

別のURLへのリダイレクト指定も可能

14

GET /.well-known/simple-web-discoveryGET /.well-known/simple-web-discovery

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

15

OpenID Connect

Dynamic Client Registration

• DiscoveryによりRegistration Endpointを取得

• Registration EndpointにClient登録/更新のリクエストを送る

16

OpenID Connect

Dynamic Client Registration

• Request (HTTP POST, JSONオブジェクト)

– type : “client_associate”/“client_update”

– client_id

– client_secret

– contact : email list

– application_type, application_name

– logo_url, redirect_url, js_origin_url, jwk_url

– sector_identifier

@_nat JWTではないのでしょうか?17

OpenID Connect

Dynamic Client Registration

• Response (JSON object)

– client_id

– client_secret

– expires_in

18

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

19

HTTP Redirect Binding

• OAuth 2.0のFlowにOpenID ConnectのRequest/Responseパラメータを加える方法

20

Protocol Flows

• Authorization Code Flow

– ClientがWeb Serverとして動作

• Implicit Flow

– ClientがJavaScript, Flashなどで動作

21

Protocol Flows

• Authorization Code Flow

– ClientがWeb Serverとして動作

• Implicit Flow

– ClientがJavaScript, Flashなどで動作

22

Authorization Code Flow

23

End User Client AuthZ

Server

Resource

Server0. Clientにサービス要求

2. AuthZ ServerにRequestを送信

3. Authentication

4. Consent/Authorization

5. AuthZ CodeとともにUserを戻す

6. Assertion要求

8. UserInfo Endpointにアクセス

1. Request準備

7. Assertion応答

9. 属性情報など応答

Authorization Code Flow

24

End User Client AuthZ

Server

Resource

Server0. Clientにサービス要求

2. AuthZ ServerにRequestを送信

3. Authentication

4. Consent/Authorization

5. AuthZ CodeとともにUserを戻す

6. Assertion要求

8. UserInfo Endpointにアクセス

1. Request準備

7. Assertion応答

9. 属性情報など応答

Requestの送り方は3種類

• Query Parameters Method

– クエリパラメータにそのまま含む

• Request Parameter Method

– OpenID Connect RequestをToken(文字列)

にしてrequestパラメータとして指定

• UserInfo/Session Management関連

• Request File Method

– JSONオブジェクトを返すURLを用意して、そのURLをパラメータに含む

25

Query Parameters Method

https://server.com/op/authorize?

response_type=token

&client_id=s6BhdRkqt3

&redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb

&scope=openid

&state=af0ifjsldkj

26

Request Parameter Method

https://server.com/op/authorize? response_type=code

&client_id=s6BhdRkqt3 &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb

&scope=openid

&state=af0ifjsldkj &request=jwt_header.jwt_payload.jwt_crypto

27

request パラメータ

• OpenID Connect リクエスト

– 下記機能についてのリクエスト

• UserInfo : 必要なクレーム、フォーマット

• Session Management : ID Tokenに含むクレーム、PAPE関連のパラメータなど

• JSONオブジェクトを文字列として表現

– “jwt_header.jwt_payload.jwt_crypto”

• jwt_header : メタデータをBase64URLEnc

• jwt_payload : JSONオブジェクトをBase64URLEnc

• jwt_crypto : Signatureなど28

Request File Method

• JSON オブジェクトを返すRequest URLを作成

https://rp.example.com/rf.js{

"response_type": "code",

"client_id": "s6BhdRkqt3",

"redirect_uri":

"https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb",

"scope": "openid",

"state": "af0ifjsldkj“

} 29

Request File Method

https://server.com/op/authorize? response_type=code

&client_id=s6BhdRkqt3

&state=af0ifjsldkj &request_uri=https://rp.example.com/rf.js

モバイルでも使えるように512byteを超えてはいけない!

30

Authorization Code Flow

31

End User Client AuthZ

Server

Resource

Server0. Clientにサービス要求

2. AuthZ ServerにRequestを送信

3. Authentication

4. Consent/Authorization

5. AuthZ CodeとともにUserを戻す

6. Assertion要求

8. UserInfo Endpointにアクセス

1. Request準備

7. Assertion応答

9. 属性情報など応答

2.5. Request File 取得

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

32

OpenID Connect Framework

• OAuth 2.0 に追加される OpenID

Connect独自リクエスト/レスポンス

• UserInfoエンドポイントで返されるClaim

•その他...

33

OpenID Request Object

• OpenID Connect リクエスト

– 下記機能についてのリクエスト

• UserInfo : 必要なクレーム、フォーマット

• Session Management : ID Tokenに含むクレーム、PAPE関連のパラメータなど

• JSONオブジェクトを文字列として表現

– “jwt_header.jwt_payload.jwt_crypto”

• jwt_header : メタデータをBase64URLEnc

• jwt_payload : JSONオブジェクトをBase64URLEnc

• jwt_crypto : Signatureなど34

OpenID Request Object{

"inf": {

"clm":

{ "name": null, "nickname": {"opt": true},

"email": null, "verified": null,

"picture": {"opt": true}, },

"fmt": "sig"

}

"idt": {

"mxa": 86400,

"eaa": "2"

}

35

UserInfo Endpoint : Claims

•下記の3種類のClaimを提供する

– Normal Claims : OPがAssertしたClaims

– Aggregated Claims : OPから返されるが、別のOPがAssertしたClaims

• JWT形式

– Distributed Claims

•別のOPのエンドポイントから返されるClaims

• endpoint, access_token

36

Authorization Code Flow

37

End User Client AuthZ

Server

Resource

Server0. Clientにサービス要求

2. AuthZ ServerにRequestを送信

3. Authentication

4. Consent/Authorization

5. AuthZ CodeとともにUserを戻す

6. Assertion要求

8. UserInfo Endpointにアクセス

1. Request準備

7. Assertion応答

9. 属性情報など応答

{

"name": "Jane Doe"

...

"_claim_names": { "birthday": "src1",

"eye_color": "src1",

"credit_score": "src3" },

"_claim_sources": {

"src1": {"JWT":

"JWT_hdr.JWT_claims.JWT_crypto"},

"src3": {"endpoint":

"https://creditagency.example.com/claimshere",

"access_token": "ksj3n283dke"} }

}

38

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

39

OpenID Connect UserInfo

• FrameworkにあったNormal Claimsについての定義

– Profileデータ

• Request

– access_token

– schema : “openid”

40

OpenID Connect UserInfo

• ResponseはJSONオブジェクト or JWT

– AuthZ Requestの際にJWT形式で指定

41

Latest Specs

• Core : Messages, Abstract flow

• Framework : Req/Res formats

• Discovery

• HTTP Redirect Binding : HTTP protocol

binding

• Session Management

• Dynamic Client Registration

• UserInfo

42

OpenID Connect

Session Management

• ID Tokenを用いたセッション管理

– 現在誰がログイン中なのか確認する

– Client側からログアウトさせる

• ID Token : JWSを用いた署名付きクレーム

– issur

– client_id

– user_id

– audience

– exp43

OpenID Connect

Session Management

• Creating Session : ID Token発行

– Authorization Request

• Clientはresponse_typeに “id_token”を含む

– Access Token Response

• AuthZ ServerはAccess Tokenと一緒にid_tokenを渡す

44

OpenID Connect

Session Management

• Session Management Endpoints

– Refresh Session : expireしたid_tokenの更新

– Check Session : id_tokenの内容取得

– End Session : Clientからのログアウト要求

45

最後に

•仕様は日々更新中

http://lists.openid.net/mailman/listinfo/ope

nid-specs-ab

46