- 追加された行はこの色です。
- 削除された行はこの色です。
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。
-[[戻る>Financial API (FAPI)]]
* 目次 [#zce5c6fe]
#contents
*概要 [#mec56743]
-[[Financial API (FAPI)]]の「Read and Write API用セキュリティ・プロファイル」
-金融データへのトランザクション・アクセスに適した[[OAuth]]プロファイル
--OpenID Connect(OIDC)を使用して顧客(ユーザ)を識別
--トークンを使用して、エンドポイントから保護データを読取
--エンドポイントは、JSONデータを提供するREST API
※ ドラフト 4 を参考にして作成。その後、ドラフト 6 を再度完読して加筆・修正。
*要約 [#sab53ee8]
-送信者・受信者・メッセージ認証を強化
-[[送信者・受信者・メッセージ認証を強化>#mea47b47]]
-以下の攻撃に対するコントロールを規定
--認可要求の改ざん
--コードインジェクション
--状態インジェクション
--トークン要求フィッシング
--認可応答の改ざん
**フロー [#y974f9a7]
このプロファイルを簡単に説明すると、以下のようになる。
***response_type [#s32102a0]
[[OpenID Connect]]の[[Hybrid Flow>OpenID Connect#l565139a]]
-code id_token
-code id_token token
--[[Confidentialクライアント>#b1fc3c02]]
--Nativeの[[Publicクライアント>#e482f66f]]の場合、S256の[[OAuth PKCE]]
-code id_token token~
SPAの[[Publicクライアント>#e482f66f]]の場合
--8.3.3. Identity provider (IdP) mix-up attackの可能性がある。
--故に、は、Implicit Flow より [[OpenID Connect]] の [[Hybrid Flow>OpenID Connect#l565139a]]の方が安全。
***request or request_uri [#h3bfbf17]
-パラメタを要求。
-[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]](必須)
-[[Requestオブジェクト>#ha94c6d8]]
**Client [#a7343049]
***Confidentialクライアント [#x56eb861]
-[[Authorization Code>OAuth#yfeb403d]]を使用して、
-+Tokenエンドポイントにクライアント認証が必要
--[[JWT Client Assertion>OpenID Connect#y7bdab62]](private_key_jwt)
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
***Publicクライアント [#k5a50e89]
[[OAuth PKCE]] を使用する。
-「ハッシュ関数」には、「S256」を使用する。
-「[[アプリケーション間通信>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E9%96%93%E9%80%9A%E4%BF%A1]]」には、「Claimed Https Scheme URI Redirection」を使用する。
**[[IDトークン>OpenID Connect#ofb73c59]] [#g7df69b2]
***[[JWT]]形式 [#r36d5748]
-[[JWS]]署名(必須)
--ES256(ECDSA using P-256 and SHA-256, Recommended+)
--PS256(RSASSA-PSS using SHA-256 and MGF1 with SHA-256, Optional)
-[[JWE]]暗号化(推奨)
***追加クレーム [#c33d2245]
-[[acrとamr>OpenID Connect - IDトークン#l52144f8]]
-[[at_hashとc_hash>OpenID Connect - IDトークン#c007540d]]
-更に、[[分離トークンのためのs_hash>#i246cd31]]。
-更に、[[切り離された署名のためのs_hash>#i246cd31]]。
***分離トークン [#i246cd31]
***切り離された署名 [#i246cd31]
-認可応答が改ざんされていないことを検証。
-クライアントは、[[at_hashとc_hash>OpenID Connect - IDトークン#c007540d]]に加え、s_hash値を検証する。
-この代替に「[[JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)]]」と言う仕様もある。
-s_hash~
state の ハッシュ値。
クライアントは、
--[[at_hashとc_hash>OpenID Connect - IDトークン#c007540d]]に加え、
--s_hash
>の値を検証する。
--値
---state 値のASCII表現のオクテットのハッシュの左端の半分をbase64urlエンコーディング
---ハッシュはIDトークンのJOSEヘッダのalgパラメタで使用されるアルゴリズム。
--例:algがHS512の場合
---state値をASCIIエンコードし、
---SHA-512でハッシュ化し、
---左端の256ビットを切り出し、
---base64urlエンコードする。
-この代替に「[[JARM>#j3ade667]]」と言う仕様もある。
**通信 [#ob9374f1]
***SSL/TLS [#l35b4184]
-TLSバージョン1.2以降
-TLSサーバ証明書チェック
-暗号スイート
--TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
--TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
--TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
--TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
***redirect_uri [#r65c6593]
(完全一致)
**認証 [#k8da384f]
***ユーザ [#l0c98773]
[[LoA 3>LoA(Level of Assurance)#kdf5a643]]
-特定される⾝元識別情報の信⽤度が「相当程度ある」。
-パスワードだけではなく、2要素以上を用いてユーザー認証をする。
***クライアント認証 [#vdf3136c]
-認可エンドポイント~
[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]](必須)
[[Requestオブジェクト>#ha94c6d8]]
-Tokenエンドポイント(以下の何れかが必要)
--[[JWT Client Assertion>OpenID Connect#y7bdab62]](private_key_jwt)
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
**トークン種類 [#x210d002]
[[記名式トークン(Proof-of-possession Token)>トークン#b38de47f]]
-対象
--code
--token
---access_token
---refresh_token
-紐付け(トークン・バインディング)のために以下の何れかをサポートする必要がある。~
(記名は、Resource Owner単位ではなくてClient単位)
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
--[[OAuth 2.0 Token Binding]]
*役割 [#a2170501]
**Authorization Server [#zf702573]
先ずは、「[[FAPI Part 1 (Read Only API Security Profile)>FAPI Part 1 (Read Only API Security Profile)#abd50397]]」に準拠。
***認証・認可 [#u62c1062]
-[[LoA 3>LoA(Level of Assurance)#kdf5a643]]
***クライアント認証 [#tf6a9f9c]
-[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
-[[OAuth 2.0 Token Binding]]
***redirect_uri [#fabee59b]
-事前登録が必要
-認可リクエストに必須
-完全一致が必要
***code, token [#mbd264d4]
-[[記名式トークン>#x210d002]]
--code
--token
---access_token
---refresh_token
-[[IDトークン>#g7df69b2]]
***[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]](必須) [#ha94c6d8]
**Client [#ide28df2]
先ずは、「[[FAPI Part 1 (Read Only API Security Profile)>FAPI Part 1 (Read Only API Security Profile)#abd50397]]」に準拠。
-[[Confidentialクライアント>#b1fc3c02]]をサポートする。
-また、[[Publicクライアント>#e482f66f]]をサポートすべき。
***Confidentialクライアント [#b1fc3c02]
-[[クライアント認証>#xebe23be]]が必要。
--[[Authorization Code>OAuth#yfeb403d]]を使用して、
--+Tokenエンドポイントにクライアント認証
---[[JWT Client Assertion>OpenID Connect#y7bdab62]](private_key_jwt)
---[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
-紐付け(トークン・バインディング)のために以下の何れかをサポートする必要がある。
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
--[[OAuth 2.0 Token Binding]]
-[[JWS]] & [[JWE]]の[[IDトークン>#g7df69b2]]を要求が推奨される。
***Publicクライアント [#e482f66f]
-[[クライアント認証>#xebe23be]]は不要。
-この代替として、S256の[[OAuth PKCE]]をサポート
--「ハッシュ関数」には、「S256」を使用する。
--「[[アプリケーション間通信>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E9%96%93%E9%80%9A%E4%BF%A1]]」には、「Claimed Https Scheme URI Redirection」を使用する。
-紐付け(トークン・バインディング)のために以下をサポートする必要がある。
--[[OAuth 2.0 Token Binding]](必須)
-[[Requestオブジェクト>#ha94c6d8]](必須)
-[[acrクレーム>OpenID Connect#ja81c8fa]]で[[LoA 3>LoA(Level of Assurance)#kdf5a643]]以上での認証を要求し、[[acrとamr>OpenID Connect - IDトークン#l52144f8]]を検証する。
**Resource Server [#fbfccde7]
先ずは、「[[FAPI Part 1 (Read Only API Security Profile)>FAPI Part 1 (Read Only API Security Profile)#abd50397]]」に準拠。
***[[記名式トークン>#x210d002]] [#c582f76f]
-[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
-[[OAuth 2.0 Token Binding]]
*[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]] [#ha94c6d8]
[[Publicクライアント>#e482f66f]]の場合、必須。
-FAPIでは、request_uriを[[Clientではなく、Authorization Serverがホストする。>JWT Secured Authorization Request (JAR)#s5ba22a4]]
--これにより、Clientが指定したrequest_uriへの要求をサポートする必要が無い。
--[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]の機密性のためにURIのエントロピーに依存しない。
--request_uriは、以下の何れか。
---URL
---URN([[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]がAuthorization Serverに保管される場合)
--なお、[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]には、すべてのパラメタを同梱する。
--OAuth2の認可リクエスト仕様で要求されている場合は、一致した重複を更に送信しても良い。
-[[Request>JWT Secured Authorization Request (JAR)#od26debf]]~
どうもこのコンテキストからすると、このリクエストは認可リクエストではなく、[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]の登録リクエストっぽい。
**[[Request>JWT Secured Authorization Request (JAR)#od26debf]] [#e104c14f]
どうも、この([[specの>#w0534ff5]])コンテキストからすると、
-このリクエストは認可リクエストではなく、[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]の登録リクエストっぽい。~
-また、この[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]の登録エンドポイントは、[[Discoveryで公開>OpenID Connect - Discovery#x1d64798]]される。
>
POST https://as.example.com/ros/ HTTP/1.1
Host: as.example.com
Content-Type: application/jws
Content-Length: 1288
eyJhbGciOiJSUzI1NiIsImtpZCI6ImsyYmRjIn0.ew0KICJpc3MiOiA
(... abbreviated for brevity ...)
zCYIb_NMXvtTIVc1jpspnTSD7xMbpL-2QgwUsAlMGzw
-Response(正常)~
なので、request_uriの形式は、URNになるのが既定と考える。
**Response [#h1b6a7de]
***正常 [#s8b86aad]
HTTP/1.1 201 Created
Date: Tue, 2 May 2017 15:22:31 GMT
Content-Type: application/json
{
'iss':'https://as.example.com/', // AuthZのID
'aud':'s6BhdRkqt3', // ClientID
'request_uri':'urn:example:MTAyODAK', // urn(暗号ランダム値)
'exp':1493738581 // 有効期限(存続期間は短く、好ましくは一回限
}
-Response(異常)
--Authorization Required~
***異常 [#y542a19a]
-Authorization Required~
401 Unauthorized HTTP error~
署名検証が失敗した場合。
--Invalid Request~
-Invalid Request~
400 Bad Request HTTP error~
[[Request>JWT Secured Authorization Request (JAR)#od26debf]]が無効
--Method Not Allowed~
-Method Not Allowed~
405 Method Not Allowed HTTP error~
POST要求を使用しなかった場合
--Request Entity Too Large~
-Request Entity Too Large~
413 Request Entity Too Large HTTP error~
要求サイズが上限を超える場合。
--Too Many Requests~
-Too Many Requests~
429 Too Many Requests HTTP error~
ある期間にClientからの要求数が上限を超えた場合。
**Client [#ide28df2]
先ずは、「[[FAPI Part 1 (Read Only API Security Profile)>FAPI Part 1 (Read Only API Security Profile)#abd50397]]」に準拠。
*セキュリティに関する考慮事項 [#mea47b47]
-[[Confidentialクライアント>#b1fc3c02]]をサポートする。
-また、[[Publicクライアント>#e482f66f]]をサポートすべき。
**[[より、強力なクライアント認証>#vdf3136c]] [#x20b41be]
***Confidentialクライアント [#b1fc3c02]
-[[クライアント認証>#xebe23be]]が必要。
**[[記名式トークン>#x210d002]] [#c3a24101]
トークン・バインディング
-紐付け(トークン・バインディング)のために以下の何れかをサポートする必要がある。
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
--[[OAuth 2.0 Token Binding]]
-JWS & JWEの[[IDトークン>#g7df69b2]]を要求が推奨される。
***Publicクライアント [#e482f66f]
-[[クライアント認証>#xebe23be]]は不要。
-この代替として、S256の[[OAuth PKCE]]をサポート
-紐付け(トークン・バインディング)のために以下をサポートする必要がある。
--[[OAuth 2.0 Token Binding]](必須)
-[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]](必須)
-[[acrクレーム>OpenID Connect#ja81c8fa]]で[[LoA 3>LoA(Level of Assurance)#kdf5a643]]以上での認証を要求し、[[acrとamr>OpenID Connect - IDトークン#l52144f8]]を検証する。
**Resource Server [#fbfccde7]
先ずは、「[[FAPI Part 1 (Read Only API Security Profile)>FAPI Part 1 (Read Only API Security Profile)#abd50397]]」に準拠。
***[[記名式トークン>#x210d002]] [#c582f76f]
-[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
-[[OAuth 2.0 Token Binding]]
*セキュリティに関する考慮事項 [#mea47b47]
-[[記名式トークン>#x210d002]]
--[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]]
--[[OAuth 2.0 Token Binding]]
**[[Publicクライアント>#e482f66f]] [#ge060720]
-[[Requestオブジェクト>JWT Secured Authorization Request (JAR)]]
--expクレームを含める必要がある。
***Hybrid Flowの選択 [#t13f32c6]
SPAの場合、
-[[OpenID Connectの追加クレーム>#g7df69b2]]+[[α>#k722ecb6]]
-OpenID Connectの追加クレーム(c_hash、at_hash)
-更に、切り離された署名のためのs_hash(codeの注入を防ぐ)
*考察 [#vebd7c4e]
**プロファイルの識別方法 [#m07867a9]
特に問題無いが、既存の(クライアント認証無しの)Flowは拒否しないといけない?~
([[OpenID Connect]]のように、「scope="* openid *"」などの識別方法が提要されていないため)
を検証するHybrid Flowが安全。
***[[Requestオブジェクト>#ha94c6d8]] [#cc9e04f8]
※ expクレームを含める必要がある。
*参考 [#w0534ff5]
-Financial Services – Financial API - Part 2: Read and Write API Security Profile~
http://openid.net/specs/openid-financial-api-part-2.html
>FAPI Read and Writeセキュリティ・プロファイル
-Financial API 実装の技術課題 - Qiita > FAPI Part 2~
https://qiita.com/TakahikoKawasaki/items/48a9d22205f77db59726#fapi-part-2
**関連仕様 [#i8ef7e99]
ただし[[OAuth]]2 / [[OIDC>OpenID Connect]]を除く。
***[[FAPI Part 1 (Read Only API Security Profile)]] [#kf1316fd]
***[[JWT bearer token authorizationグラント種別]] [#b862e2eb]
***[[OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens]] [#yc3529a9]
***[[OAuth 2.0 Token Binding]] [#b8a7bd37]
***[[JWT Secured Authorization Request (JAR)]] [#icf72f77]
***[[JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)]] [#j3ade667]
----
Tags: [[:IT国際標準]], [[:認証基盤]], [[:クレームベース認証]], [[:OAuth]]