「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-[[戻る>FAPI Part 2 (Read and Write API Security Profile)]]
-戻る
--[[JWTとOAuth2.0]]
--[[FAPI Part 2 (Read and Write API Security Profile)]]

* 目次 [#x774c2a7]
#contents

*概要 [#ta7069e9]
-ドイツの金融業界の要望に対応するため、驚くほどのスピードで策定され、~
駆け込みで FAPI Implementer's Draft 第二版と一緒に処理された。

-[[FAPI Part 2 (Read and Write API Security Profile)]]では、[[分離トークン(s_hash)>FAPI Part 2 (Read and Write API Security Profile)#i246cd31]]の代替手段だと書かれている。

-認可レスポンスのパラメタ群が一つの JWT にまとめられ、response={JWT} という形式で返ってくる。

--JWT形式で Authorization Response を返すための仕様

--[[Response Mode を指定するための response_mode パラメタ>OAuth 2.0 Form Post Response Mode]]も拡張する

--Client / Authorization Server それぞれの metadata も拡張する

※ よくよく見ると、[[JWT Secured Authorization Request (JAR)]](リクエスト)のレスポンス版である。

*詳細 [#wdfc0b3d]
-Authorization Response に JWT を使う方法が定義されている。
-[[Response Type>OAuth 2.0 Multiple Response Type Encoding Practices]], [[Response Mode>OAuth 2.0 Form Post Response Mode]] により、挙動とJWTの中身が違ってくる。
-JWTのalgなどは仕様範囲外なので、よく考えて設計する必要がある。

**Discovery/Registration [#ef0c71f9]
**Discovery / Registration [#ef0c71f9]

***[[Discovery>OpenID Connect - Discovery]] [#k71e4d3e]
response_modes_supportedパラメタで

-[[response_mode>#jdf53132]]
-[[AuthZ metadata>#be301260]]

をアドバタイズ

***[[Registration>OpenID Connect - Dynamic Client Registration]] [#m74d521b]
[[Client metadata>#x88195b8]]を登録。

**metadata [#q6882927]
**Metadata [#q6882927]

***Client metadata [#x88195b8]
Clientが、JWT の署名・暗号にどのアルゴリズムを使用して欲しいかを指定。

-authorization_signed_response_alg
-authorization_encrypted_response_alg
-authorization_encrypted_response_enc

***AuthZ metadata [#be301260]
AuthZがサポートするJWT の署名・暗号アルゴリズムを列挙。
-authorization_signing_alg_values_supported
-authorization_encryption_alg_values_supported
-authorization_encryption_enc_values_supported

**[[response_mode>OAuth 2.0 Form Post Response Mode]] [#jdf53132]

***query.jwt [#le68ebcd]
 HTTP/1.1 302 Found
 Location: https://client.com/callback?response={JWT}

***fragment.jwt [#w7232cda]
 HTTP/1.1 302 Found
 Location: https://client.example.com/cb#response={JWT}

***form_post.jwt [#xbf7b21a]
 HTTP/1.1 200 OK
 Content-Type: text/html;charset=UTF-8
 Cache-Control: no-cache, no-store
 Pragma: no-cache
 <html>
   <head><title>Submit This Form</title></head>
   <body onload="javascript:document.forms[0].submit()">
     <form method="post" action="https://client.example.com/cb">
      <input type="hidden" name="response" value="{JWT}"/>
     </form>
   </body>
 </html>

***jwt [#b838208d]
-ショートカット。以下の何れかを示す。

-[[response_type>OAuth 2.0 Multiple Response Type Encoding Practices]]が、
--"code"の場合、[[query.jwt>#le68ebcd]]
--"token"の場合、[[fragment.jwt>#w7232cda]]

**JWT [#fbb6fcfa]
**[[response_type>OAuth 2.0 Multiple Response Type Encoding Practices]] [#fbb6fcfa]
上記の{JWT}には、以下のペイロードを署名してJWS化したものを入れる。

***code [#j941ae96]
 {
   "iss":"https://accounts.example.com",
   "aud":"s6BhdRkqt3",
   "exp":1311281970,
   "code":"PyyFaux2o7Q0YfXBU32jhw.5FXSQpvr8akv9CeRDSd0QA",
   "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw"
 }

***token [#b15366cd]
 {
    "iss":"https://accounts.example.com",
    "aud":"s6BhdRkqt3",
    "exp":1311281970,
    "access_token":"2YotnFZFEjr1zCsicMWpAA",
    "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw",
    "token_type":"bearer",
    "expires_in":"3600",
    "scope":"example"
 }

***error [#j941ae96]
 {
    "error":"access_denied",
    "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw"
 }

**実装に関する考察。 [#yc74604a]

***ベースライン [#s4b02fd0]
-一般的に[[code>#v81da939]]系と[[token>#x0febf97]]系でエンドポイントが分かれている。
-queryとpostの共通化は(MVCのを使用している場合、バインダ機能により)容易のハズ。
-fragmentについては、サーバで処理できないのでRedirectエンドポイントではスルーすれば良い(実装不要)。

***code (authorization code) [#v81da939]

-既定値
--query

-追加実装~
既存のエンドポイントを流用可

--query系
---query~
既定値
---query.jwt~
検証・デコード処理を追加。

--fragment系
---fragment~
SPAでPKCEを使用する際に必要になる。
---fragment.jwt~
SPAでPKCEを使用する際に必要になる(jwtでセキュリティ強化)。

--form_post系
---form_post~
Formsから取得(メジャーなユースケース)。
---form_post.jwt~
Formsから検証・デコードする。


-実装不要~
...。

***token (Implicit, Hybrid) [#x0febf97]

-既定値
--fragment

-追加実装~
既存のエンドポイントを流用可

--fragmen系
---fragmen~
既定値
---fragment.jwt~
検証・デコード処理を追加。

--form_post系
---form_post~
Formsから取得し、Hiddenに入れる。
---form_post.jwt~
Formsから検証・デコードし、Hiddenに入れる。

-実装不要
--query系~
fragment → queryはNG(JWE化していればOKらしいが...。)
---query
---query.jwt

*参考 [#x941b618]
-Draft-nn: Financial-grade API: JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)~
https://openid.net/specs/openid-financial-api-jarm.html

**インフル諸兄 [#j1267125]

***TakahikoKawasaki [#h306ef44]
-OAuth 2.0 の認可レスポンスとリダイレクトに関する説明 - Qiita~
JWT Secured Authorization Response Mode~
https://qiita.com/TakahikoKawasaki/items/8567c80528da43c7e844#jwt-secured-authorization-response-mode

***ritou [#kfb57e70]
-FAPI : JWT Secured Authorization Response Mode for OAuth 2.0 (JARM) とは - r-weblife~
https://ritou.hatenablog.com/entry/2018/09/21/143349

**関連仕様 [#t43a5fc4]
***[[OAuth 2.0 Form Post Response Mode]] [#g80b53c7]
***[[OAuth 2.0 Multiple Response Type Encoding Practices]] [#b0c7ea81]

***[[OpenID Connect - Discovery]] [#n79fb3c3]
***[[OpenID Connect - Dynamic Client Registration]] [#q62b2628]

***[[FAPI Part 2 (Read and Write API Security Profile)]] [#a1e49096]

----
Tags: [[:IT国際標準]], [[:認証基盤]], [[:クレームベース認証]], [[:OAuth]]


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS