<?xml version='1.0' encoding='ascii'?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<rfc ipr="trust200902" category="info" docName="opend-fapi-financial_api_jwt_secured_authorization_response_mode" obsoletes="" updates="" submissionType="IETF" xml:lang="en">
  <?rfc toc="yes" ?>
  <?rfc tocdepth="4" ?>
  <?rfc symrefs="yes" ?>
  <?rfc sortrefs="yes"?>
  <?rfc strict="yes" ?>
  <?rfc iprnotified="no" ?>
  <?rfc private="Draft-02" ?>
  <front>
    <title abbrev="FAPI - Part 2">Financial-grade API: JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)</title>
    <author fullname="Torsten Lodderstedt" initials="T." surname="Lodderstedt">
      <organization abbrev="Yes">YES</organization>
      <address>
        <email>torsten@lodderstedt.net </email>
        <uri>http://yes.com/</uri>
      </address>
    </author>
    <author fullname="Brian Campbell" initials="B." surname="Campbell">
      <organization abbrev="Ping">Ping Identity</organization>
      <address>
        <email>bcampbell@pingidentity.com</email>
        <uri>http://www.pingidentity.com/</uri>
      </address>
    </author>
    <date day="17" month="October" year="2018"/>
    <note title="Warning">
      <t>This document is not an OIDF International Standard. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an International Standard.  </t>
      <t>Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.  </t>
    </note>
    <note title="Copyright notice &amp; license">
      <t>The OpenID Foundation (OIDF) grants to any Contributor, developer, implementer, or other interested party a non-exclusive, royalty free, worldwide copyright license to reproduce, prepare derivative works from, distribute, perform and display, this Implementers Draft or Final Specification solely for the purposes of (i) developing specifications, and (ii) implementing Implementers Drafts and Final Specifications based on such documents, provided that attribution be made to the OIDF as the source of the material, but that such attribution does not indicate an endorsement by the OIDF.</t>
      <t>The technology described in this specification was made available from contributions from various sources, including members of the OpenID Foundation and others. Although the OpenID Foundation has taken steps to help ensure that the technology is available for distribution, it takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this specification or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any independent effort to identify any such rights. The OpenID Foundation and the contributors to this specification make no (and hereby expressly disclaim any) warranties (express, implied, or otherwise), including implied warranties of merchantability, non-infringement, fitness for a particular purpose, or title, related to this specification, and the entire risk as to implementing this specification is assumed by the implementer. The OpenID Intellectual Property Rights policy requires contributors to offer a patent promise not to assert certain patent claims against other contributors and against implementers. The OpenID Foundation invites any interested party to bring to its attention any copyrights, patents, patent applications, or other proprietary rights that may cover technology that may be required to practice this specification.</t>
    </note>
    <note title="Foreword">
      <t>The OpenID Foundation (OIDF) promotes, protects and nurtures the OpenID community and technologies. As a non-profit international standardizing body, it is comprised by over 160 participating entities (workgroup participants). The work of preparing implementer drafts and final international standards is carried out through OIDF workgroups in accordance with the OpenID Process. Participants interested in a subject for which a workgroup has been established has the right to be represented in that workgroup. International organizations, governmental and non-governmental, in liaison with OIDF, also take part in the work. OIDF collaborates closely with other standardizing bodies in the related fields.</t>
      <t>Final drafts adopted by the Workgroup through consensus are circulated publicly for the public review for 60 days and for the OIDF members for voting. Publication as an OIDF Standard requires approval by at least 50 % of the members casting a vote. There is a possibility that some of the elements of this document may be the subject to patent rights. OIDF shall not be held responsible for identifying any or all such patent rights.</t>
      <t>Financial-grade API consists of the following parts:</t>
      <t>
        <list style="symbols">
          <t>Part 1: Read-Only API Security Profile </t>
          <t>Part 2: Read and Write API Security Profile </t>
          <t>Client Initiated Backchannel Authentication Profile</t>
        </list>
      </t>
      <t>Future parts may follow.</t>
      <t>These parts are intended to be used with [RFC6749], [RFC6750], [RFC7636], and [OIDC].</t>
    </note>
    <note title="Introduction">
      <t>Fintech is an area of future economic growth around the world and Fintech organizations need to improve the security of their operations and protect customer data. It is common practice of aggregation services to use screen scraping as a method to capture data by storing users' passwords. This brittle, inefficient, and insecure practice creates security vulnerabilities which require financial institutions to allow what appears to be an automated attack against their applications and to maintain a whitelist of aggregators. A new draft standard, proposed by this workgroup would instead utilize an API model with structured data and a token model, such as OAuth [RFC6749, RFC6750].</t>
      <t>The Financial-grade API aims to provide specific implementation guidelines for online financial services to adopt by developing a REST/JSON data model protected by a highly secured OAuth profile.</t>
      <t>This document defines a new JWT-based mode to encode authorization responses. Clients are enabled to request the transmission of the authorization response parameters along with additional data in JWT format. This mechanism enhances the security of the standard authorization response since it adds support for signing and encryption, sender authentication, audience restriction as well as protection from replay, credential leakage, and mix-up attacks. It can be combined with any response type.</t>
    </note>
    <note title="Notational conventions">
      <t>The keywords "shall", "shall not", "should", "should not", "may", and "can" in this document are to be interpreted as described in ISO Directive Part 2 [ISODIR2]. These keywords are not used as dictionary terms such that any occurrence of them shall be interpreted as keywords and are not to be interpreted with their natural language meanings.</t>
    </note>
  </front>
  <middle><!--This document was prepared using Pandoc2rfc, https://github.com/miekg/pandoc2rfc --><section title="Normative references" anchor="normative-references" toc="default"><t>The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applied. For undated references, the latest edition of the referenced document (including any amendments) applies.  </t><t>[RFC7230] - Hypertext Transfer Protocol -- HTTP/1.1 [RFC7230]: https://tools.ietf.org/html/rfc7230 </t><t>[RFC6749] - The OAuth 2.0 Authorization Framework [RFC6749]: https://tools.ietf.org/html/rfc6749 </t><t>[RFC6750] - The OAuth 2.0 Authorization Framework: Bearer Token Usage [RFC6750]: https://tools.ietf.org/html/rfc6750 </t><t>[RFC7636] - Proof Key for Code Exchange by OAuth Public Clients [RFC7636]: https://tools.ietf.org/html/rfc7636 </t><t>[RFC6819] - OAuth 2.0 Threat Model and Security Considerations [RFC6819]: https://tools.ietf.org/html/rfc6819 </t><t>[RFC7515] - JSON Web Signature (JWS) [RFC7515]:https://tools.ietf.org/html/rfc7515 </t><t>[RFC7516] - JSON Web Encryption (JWE) [RFC7516]:https://tools.ietf.org/html/rfc7516 </t><t>[RFC7517] - JSON Web Key (JWK) [RFC7517]:https://tools.ietf.org/html/rfc7517 </t><t>[RFC7518] - JSON Web Algorithms (JWA) [RFC7518]:https://tools.ietf.org/html/rfc7518 </t><t>[RFC7519] - JSON Web Token (JWT) [RFC7519]:https://tools.ietf.org/html/rfc7519 </t><t>[BCP195] - Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) [BCP195]: https://tools.ietf.org/html/bcp195 </t><t>[RFC7591] - OAuth 2.0 Dynamic Client Registration Protocol [RFC7591]: https://tools.ietf.org/html/RFC7591 </t><t>[RFC8414] - OAuth 2.0 Authorization Server Metadata [RFC8414]: https://tools.ietf.org/html/rfc8414 </t><t>[OIDC] - OpenID Connect Core 1.0 incorporating errata set 1 [OIDC]: http://openid.net/specs/openid-connect-core-1_0.html </t><t>[OIDD] - OpenID Connect Discovery 1.0 incorporating errata set 1 [OIDD]: http://openid.net/specs/openid-connect-discovery-1_0.html </t><t>[OIDM] - OAuth 2.0 Multiple Response Type Encoding Practices [OIDM]: http://openid.net/specs/oauth-v2-multiple-response-types-1_0.html </t><t>[OIFP] - OAuth 2.0 Form Post Response Mode [OIFP]: http://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html </t><t>[draft-ietf-oauth-security-topics] - OAuth 2.0 Security Best Current Practice [draft-ietf-oauth-security-topics]: https://tools.ietf.org/html/draft-ietf-oauth-security-topics </t><t>[OISM] - OpenID Connect Session Management 1.0 [OISM]: http://openid.net/specs/openid-connect-session-1_0.html </t></section><section title="Terms and definitions" anchor="terms-and-definitions" toc="default"><t>For the purpose of this document, the terms defined in [RFC6749], [RFC6750], [RFC7636], [OpenID Connect Core][OIDC] apply.  </t></section><section title="Symbols and Abbreviated terms" anchor="symbols-and-abbreviated-terms" toc="default"><t><spanx style="strong" xml:space="preserve">API</spanx> &#8211; Application Programming Interface </t><t><spanx style="strong" xml:space="preserve">CSRF</spanx> - Cross Site Request Forgery </t><t><spanx style="strong" xml:space="preserve">FAPI</spanx> - Financial-grade API </t><t><spanx style="strong" xml:space="preserve">HTTP</spanx> &#8211; Hyper Text Transfer Protocol </t><t><spanx style="strong" xml:space="preserve">OIDF</spanx> - OpenID Foundation </t><t><spanx style="strong" xml:space="preserve">REST</spanx> &#8211; Representational State Transfer </t><t><spanx style="strong" xml:space="preserve">TLS</spanx> &#8211; Transport Layer Security </t></section><section title="JWT-based Response Mode" anchor="jwt-based-response-mode" toc="default"><t>This document defines a new JWT-based mode to encode authorization responses parameters. All response parameters defined for a given response type are conveyed in a JWT along with additional fields used to further protect the transmission. Since there are different techniques to encode the JWT itself in the response to the client, namely query URI parameter, fragment component and form post, this draft defines a set of response mode values in accordance with [OIDM] corresponding to this techniques.  </t><section title="The JWT Response Document" anchor="the-jwt-response-document" toc="default"><t>The JWT always contains the following data utilized to secure the transmission: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">iss</spanx> - the issuer URL of the authorization server that created the response </t><t><spanx style="verb" xml:space="preserve">aud</spanx> - the client_id of the client the response is intended for </t><t><spanx style="verb" xml:space="preserve">exp</spanx> - expiration of the JWT </t></list></t><t>The JWT furthermore contains the authorization endpoint response parameters as defined for the particular response types, even in case of an error response. This pattern is applicable to all response types including those defined in [OIDM]. The following subsections illustrate the pattern with the response types "code" and "token".  </t><t>Note: Additional authorization endpoint response parameters defined by extensions, e.g. <spanx style="verb" xml:space="preserve">session_state</spanx> as defined in [OISM], will also be added to the JWT.  </t><section title="Response Type &quot;code&quot;" anchor="response-type-code" toc="default"><t>For the grant type authorization "code" the JWT contains the response parameters as defined in [RFC6749], sections 4.1.2: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">code</spanx> - the authorization code </t><t><spanx style="verb" xml:space="preserve">state</spanx> - the state value as sent by the client in the authorization request </t></list></t><t>The following example shows the JWT claims for a successful "code" authorization response: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
{  
   "iss":"https://accounts.example.com",
   "aud":"s6BhdRkqt3",
   "exp":1311281970,
   "code":"PyyFaux2o7Q0YfXBU32jhw.5FXSQpvr8akv9CeRDSd0QA",  
   "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw"
}
</artwork></figure><t>In case of an error response, the JWT contains the error response parameters as defined in [RFC6749], sections 4.1.2.1: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">error</spanx> - the error code </t><t><spanx style="verb" xml:space="preserve">error_description</spanx> (OPTIONAL) - a human readable description of the error </t><t><spanx style="verb" xml:space="preserve">error_uri</spanx> (OPTIONAL) - a URI identifying a human-readable web page with information about the error </t><t><spanx style="verb" xml:space="preserve">state</spanx> - the state value as sent by the client in the authorization request </t></list></t><t>The following example shows the JWT payload for such an error response: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
{  
   "error":"access_denied",
   "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw"
}
</artwork></figure></section><section title="Response Type &quot;token&quot;" anchor="response-type-token" toc="default"><t>For the grant type "token" the JWT contains the response parameters as defined in [RFC6749], sections 4.2.2: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">access_token</spanx> - the access token </t><t><spanx style="verb" xml:space="preserve">token_type</spanx> - the type of the access token </t><t><spanx style="verb" xml:space="preserve">expires_in</spanx> - when the access token expires </t><t><spanx style="verb" xml:space="preserve">scope</spanx> - the scope granted with the access token </t><t><spanx style="verb" xml:space="preserve">state</spanx> - the state value as sent by the client in the authorization request </t></list></t><t>The following example shows the claims of the JWT for a successful "token" authorization response: </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
{  
   "iss":"https://accounts.example.com",
   "aud":"s6BhdRkqt3",
   "exp":1311281970,
   "access_token":"2YotnFZFEjr1zCsicMWpAA",
   "state":"S8NJ7uqk5fY4EjNvP_G_FtyJu6pUsvH9jsYni9dMAJw",
   "token_type":"bearer",
   "expires_in":"3600",
   "scope":"example"   
}
</artwork></figure><t>In case of an error response, the JWT contains the error response parameters in the same manner as with the response type "code".  </t></section></section><section title="Signing and Encryption" anchor="signing-and-encryption" toc="default"><t>The JWT is either signed, or signed and encrypted. If the JWT is both signed and encrypted, the JSON document will be signed then encrypted, with the result being a Nested JWT, as defined in [RFC7519].  </t><t>The authorization server determines what algorithm to employ to secure the JWT for a particular authorization response. This decision can be based on registered metadata parameters for the client as defined by this draft (see section 5).  </t><t>For guidance on key management in general and especially on use of symmetric algorithms for signing and encrypting based on client secrets see sections 10.1 and 10.2 of [OIDC].  </t></section><section title="Response Encoding" anchor="response-encoding" toc="default"><t>This draft defines the following response mode values: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">query.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">fragment.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">form_post.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">jwt</spanx> </t></list></t><section title="Response Mode &quot;query.jwt&quot;" anchor="response-mode-query.jwt" toc="default"><t>The response mode "query.jwt" causes the authorization server to send the authorization response as HTTP redirect to the redirect URI of the client. The authorization server adds the parameter <spanx style="verb" xml:space="preserve">response</spanx> containing the JWT as defined in section 4.1. to the query component of the redirect URI using the "application/x-www-form-urlencoded" format.  </t><t>This is an example response (line breaks for display purposes only): </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
HTTP/1.1 302 Found
Location: https://client.example.com/cb?
response=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FjY291bnRzLm
V4YW1wbGUuY29tIiwiYXVkIjoiczZCaGRSa3F0MyIsImV4cCI6MTMxMTI4MTk3MCwiY29kZSI6IlB5eU
ZhdXgybzdRMFlmWEJVMzJqaHcuNUZYU1FwdnI4YWt2OUNlUkRTZDBRQSIsInN0YXRlIjoiUzhOSjd1cW
s1Zlk0RWpOdlBfR19GdHlKdTZwVXN2SDlqc1luaTlkTUFKdyJ9.HkdJ_TYgwBBj10C-aWuNUiA062Amq
2b0_oyuc5P0aMTQphAqC2o9WbGSkpfuHVBowlb-zJ15tBvXDIABL_t83q6ajvjtq_pqsByiRK2dLVdUw
KhW3P_9wjvI0K20gdoTNbNlP9Z41mhart4BqraIoI8e-L_EfAHfhCG_DDDv7Yg
</artwork></figure><t>Note: "query.jwt" MUST NOT be used in conjunction with response types that contain "token" or "id_token" unless the response JWT is encrypted to prevent token leakage in the URL.  </t></section><section title="Response Mode &quot;fragment.jwt&quot;" anchor="response-mode-fragment.jwt" toc="default"><t>The response mode "fragment.jwt" causes the authorization server to send the authorization response as HTTP redirect to the redirect URI of the client. The authorization server adds the parameter <spanx style="verb" xml:space="preserve">response</spanx> containing the JWT as defined in section 4.1. to the fragment component of the redirect URI using the "application/x-www-form-urlencoded" format.  </t><t>This is an example response (line breaks for display purposes only): </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
HTTP/1.1 302 Found
Location: https://client.example.com/cb#
response=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FjY291bnRzLm
V4YW1wbGUuY29tIiwiYXVkIjoiczZCaGRSa3F0MyIsImV4cCI6MTMxMTI4MTk3MCwiYWNjZXNzX3Rva2
VuIjoiMllvdG5GWkZFanIxekNzaWNNV3BBQSIsInN0YXRlIjoiUzhOSjd1cWs1Zlk0RWpOdlBfR19GdH
lKdTZwVXN2SDlqc1luaTlkTUFKdyIsInRva2VuX3R5cGUiOiJiZWFyZXIiLCJleHBpcmVzX2luIjoiMz
YwMCIsInNjb3BlIjoiZXhhbXBsZSJ9.bgHLOu2dlDjtCnvTLK7hTN_JNwoZXEBnbXQx5vd9z17v1Hyzf
Mqz00Vi002T-SWf2JEs3IVSvAe1xWLIY0TeuaiegklJx_gvB59SQIhXX2ifzRmqPoDdmJGaWZ3tnRyFW
NnEogJDqGFCo2RHtk8fXkE5IEiBD0g-tN0GS_XnxlE
</artwork></figure></section><section title="Response Mode &quot;form_post.jwt&quot;" anchor="response-mode-form_post.jwt" toc="default"><t>The response mode "form_post.jwt" uses the technique described in [OIFP] to convey the JWT to the client. The <spanx style="verb" xml:space="preserve">response</spanx> parameter containing the JWT is encoded as HTML form value that is auto-submitted in the User Agent, and thus is transmitted via the HTTP POST method to the Client, with the result parameters being encoded in the body using the "application/x-www-form-urlencoded" format.  </t><t>This is an example response from the authorization server to the user agent (line breaks for display purposes only), </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache, no-store
Pragma: no-cache

&lt;html&gt;
 &lt;head&gt;&lt;title&gt;Submit This Form&lt;/title&gt;&lt;/head&gt;
 &lt;body onload="javascript:document.forms[0].submit()"&gt;
  &lt;form method="post" action="https://client.example.com/cb"&gt;
    &lt;input type="hidden" name="response"
     value="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2
      FjY291bnRzLmV4YW1wbGUuY29tIiwiYXVkIjoiczZCaGRSa3F0MyIsImV4cCI6MTM
      xMTI4MTk3MCwiYWNjZXNzX3Rva2VuIjoiMllvdG5GWkZFanIxekNzaWNNV3BBQSIs
      InN0YXRlIjoiUzhOSjd1cWs1Zlk0RWpOdlBfR19GdHlKdTZwVXN2SDlqc1luaTlkT
      UFKdyIsInRva2VuX3R5cGUiOiJiZWFyZXIiLCJleHBpcmVzX2luIjoiMzYwMCIsIn
      Njb3BlIjoiZXhhbXBsZSJ9.bgHLOu2dlDjtCnvTLK7hTN_JNwoZXEBnbXQx5vd9z1
      7v1HyzfMqz00Vi002T-SWf2JEs3IVSvAe1xWLIY0TeuaiegklJx_gvB59SQIhXX2i
      fzRmqPoDdmJGaWZ3tnRyFWNnEogJDqGFCo2RHtk8fXkE5IEiBD0g-tN0GS_XnxlE"/&gt;
    &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;  
</artwork></figure><t>which results in the following POST request to the client's redirect URI.  </t><figure title="" suppress-title="false" align="left" alt="" width="" height=""><artwork xml:space="preserve" name="" type="" align="left" alt="" width="" height="">
  POST /cb HTTP/1.1
  Host: client.example.org
  Content-Type: application/x-www-form-urlencoded

  response=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2
      FjY291bnRzLmV4YW1wbGUuY29tIiwiYXVkIjoiczZCaGRSa3F0MyIsImV4cCI6MTM
      xMTI4MTk3MCwiYWNjZXNzX3Rva2VuIjoiMllvdG5GWkZFanIxekNzaWNNV3BBQSIs
      InN0YXRlIjoiUzhOSjd1cWs1Zlk0RWpOdlBfR19GdHlKdTZwVXN2SDlqc1luaTlkT
      UFKdyIsInRva2VuX3R5cGUiOiJiZWFyZXIiLCJleHBpcmVzX2luIjoiMzYwMCIsIn
      Njb3BlIjoiZXhhbXBsZSJ9.bgHLOu2dlDjtCnvTLK7hTN_JNwoZXEBnbXQx5vd9z1
      7v1HyzfMqz00Vi002T-SWf2JEs3IVSvAe1xWLIY0TeuaiegklJx_gvB59SQIhXX2i
      fzRmqPoDdmJGaWZ3tnRyFWNnEogJDqGFCo2RHtk8fXkE5IEiBD0g-tN0GS_XnxlE
</artwork></figure></section><section title="Response Mode &quot;jwt&quot;" anchor="response-mode-jwt" toc="default"><t>The response mode "jwt" is a shortcut and indicates the default redirect encoding (query, fragment) for the requested response type. The default for response type "code" is "query.jwt" whereas the default for "token" and the response types defined in [OIDM], except "none", is "fragment.jwt".  </t></section></section><section title="Processing rules" anchor="processing-rules" toc="default"><t>Assumption: the client remembers the authorization server to which it sent the authorization request and binds this information to the user agent.  </t><t>The client is obliged to process the JWT secured response as follows: </t><t><list style="numbers"><t>(OPTIONAL) The client decrypts the JWT using the key determined by the <spanx style="verb" xml:space="preserve">kid</spanx> JWT header parameter.  The key might be a private key, where the corresponding public key is registered with the expected issuer of the response ("use":"enc" via the client's metadata <spanx style="verb" xml:space="preserve">jwks</spanx> or <spanx style="verb" xml:space="preserve">jwks_uri</spanx>) or a key derived from its client secret (see section 4.2).  </t><t>The client obtains the <spanx style="verb" xml:space="preserve">state</spanx> parameter from the JWT and checks its binding to the user agent. If the check fails, the client MUST abort processing and refuse the response.  </t><t>The client obtains the <spanx style="verb" xml:space="preserve">iss</spanx> element from the JWT and checks whether its value is well known and identifies the expected issuer of the authorization process in examination. If the check fails, the client MUST abort processing and refuse the response.  </t><t>The client obtains the <spanx style="verb" xml:space="preserve">aud</spanx> element from the JWT and checks whether it matches the client id the client used to identify itself in the corresponding authorization request. If the check fails, the client MUST abort processing and refuse the response.  </t><t>The client checks the JWT's <spanx style="verb" xml:space="preserve">exp</spanx> element to determine if the JWT is still valid. If the check fails, the client MUST abort processing and refuse the response.  </t><t>The client obtains the key needed to check the signature based on the JWT's <spanx style="verb" xml:space="preserve">iss</spanx> element and the <spanx style="verb" xml:space="preserve">kid</spanx> header element and checks its signature. If the check fails, the client MUST abort processing and refuse the response.  </t></list></t><t>Note: The <spanx style="verb" xml:space="preserve">state</spanx> value is treated as a one-time-use CSRF token. It MUST be invalidated after the check (step 2) was performed. Note: The way the client obtains the keys for verifying the JWT's signature (step 5) is out of scope of this draft. Established mechanism such as [OIDD] or [RFC8414] SHOULD be utilized.  </t><t>The client MUST NOT process the grant type specific authorization response parameters before all checks succeed.  </t></section></section><section title="Client Metadata" anchor="client-metadata" toc="default"><t>The parameter names follow the pattern established by OpenID Connect Dynamic Client Registration [OpenID.Registration] for configuring signing and encryption algorithms for JWT responses at the UserInfo endpoint.  </t><t>The following client metadata parameters are introduced by this specification: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">authorization_signed_response_alg</spanx> JWS [RFC7515] <spanx style="verb" xml:space="preserve">alg</spanx> algorithm JWA [RFC7518] REQUIRED for signing authorization responses. If this is specified, the response will be signed using JWS and the configured algorithm. The algorithm <spanx style="verb" xml:space="preserve">none</spanx> is not allowed. The default, if omitted, is RS256.  </t><t><spanx style="verb" xml:space="preserve">authorization_encrypted_response_alg</spanx> JWE [RFC7516] <spanx style="verb" xml:space="preserve">alg</spanx> algorithm JWA [RFC7518] REQUIRED for encrypting authorization responses. If both signing and encryption are requested, the response will be signed then encrypted, with the result being a Nested JWT, as defined in JWT [RFC7519]. The default, if omitted, is that no encryption is performed.  </t><t><spanx style="verb" xml:space="preserve">authorization_encrypted_response_enc</spanx> JWE [RFC7516] <spanx style="verb" xml:space="preserve">enc</spanx> algorithm JWA [RFC7518] REQUIRED for encrypting authorization responses. If <spanx style="verb" xml:space="preserve">authorization_encrypted_response_alg</spanx> is specified, the default for this value is A128CBC-HS256. When <spanx style="verb" xml:space="preserve">authorization_encrypted_response_enc</spanx> is included, <spanx style="verb" xml:space="preserve">authorization_encrypted_response_alg</spanx> MUST also be provided.  </t></list></t><t>Clients may register their public encryption keys using the <spanx style="verb" xml:space="preserve">jwks_uri</spanx> or <spanx style="verb" xml:space="preserve">jwks</spanx> metadata parameters.  </t></section><section title="Authorization Server Metadata" anchor="authorization-server-metadata" toc="default"><t>Authorization servers SHOULD publish the supported algorithms for signing and encrypting the JWT of an authorization response by utilizing OAuth 2.0 Authorization Server Metadata [RFC8414] parameters.  </t><t>The following parameters are introduced by this specification: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">authorization_signing_alg_values_supported</spanx> OPTIONAL. JSON array containing a list of the JWS [RFC7515] signing algorithms (<spanx style="verb" xml:space="preserve">alg</spanx> values) JWA [RFC7518] supported by the authorization endpoint to sign the response.  </t><t><spanx style="verb" xml:space="preserve">authorization_encryption_alg_values_supported</spanx> OPTIONAL. JSON array containing a list of the JWE [RFC7516] encryption algorithms (<spanx style="verb" xml:space="preserve">alg</spanx> values) JWA [RFC7518] supported by the authorization endpoint to encrypt the response.  </t><t><spanx style="verb" xml:space="preserve">authorization_encryption_enc_values_supported</spanx> OPTIONAL. JSON array containing a list of the JWE [RFC7516] encryption algorithms (<spanx style="verb" xml:space="preserve">enc</spanx> values) JWA [RFC7518] supported by the authorization endpoint to encrypt the response.  </t></list></t><t>Authorization servers SHOULD publish the supported response mode values utilizing the parameter <spanx style="verb" xml:space="preserve">response_modes_supported</spanx> as defined in [RFC8414].  This draft introduces the following possible values: </t><t><list style="symbols"><t><spanx style="verb" xml:space="preserve">query.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">fragment.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">form_post.jwt</spanx> </t><t><spanx style="verb" xml:space="preserve">jwt</spanx> </t></list></t></section><section title="Security considerations" anchor="security-considerations" toc="default"><section title="DoS using specially crafted JWTs" anchor="dos-using-specially-crafted-jwts" toc="default"><t>JWTs could be crafted to have an issuer that resolves to a JWK set URL with huge content, or is delivered very slowly, consuming server networking bandwidth and compute capacity. The resolved JWK set URL could also be used to DDoS targets on the web.  </t><t>The client therefore MUST first check that the issuer of the JWT is well-known and expected for the particular authorization response before it uses this data to obtain the key needed to check the JWT's signature.  </t></section><section title="Code Replay" anchor="code-replay" toc="default"><t>An authorization code (obtained on a different device with the same client) could be injected into an authorization response in order to impersonate the legitimate resource owner (see [draft-ietf-oauth-security-topics]).  </t><t>The JWT secured response mode enables clients to detect such an attack. The signature binds the authorization code to the state value sent by the client and therewith transitively to the transaction in the respective user agent.  </t></section><section title="Mix-Up" anchor="mix-up" toc="default"><t>Mix-up is an attack on scenarios where an OAuth client interacts with multiple authorization servers. The goal of the attack is to obtain an authorization code or an access token by tricking the client into sending those credentials to the attacker instead of using them at the respective endpoint at the authorization/resource server.  </t><t>The JWT secured response mode enables clients to detect this attack by providing an identification of the sender (<spanx style="verb" xml:space="preserve">iss</spanx>) and the intended audience of the authorization response (<spanx style="verb" xml:space="preserve">aud</spanx>).  </t></section><section title="Code Leakage" anchor="code-leakage" toc="default"><t>Authorization servers MAY encrypt the authorization response therewith providing a means to prevent leakage of authorization codes in the user agent (e.g. during transmission, in browser history or via referrer headers).  </t></section></section><section title="Privacy considerations" anchor="privacy-considerations" toc="default"><t>TBD </t></section><section title="Acknowledgement" anchor="acknowledgement" toc="default"><t>The following people contributed to this document: </t><t><list style="symbols"><t>Torsten Lodderstedt (YES), Editor </t><t>Brian Campbell (Ping Identity), Co-editor </t><t>Nat Sakimura (Nomura Research Institute) -- Chair </t><t>Dave Tonge (Momentum Financial Technology) -- UK Implementation Entity Liaison </t><t>Joseph Heenan (Authlete) </t><t>Ralph Bragg (Raidiam) </t><t>Vladimir Dzhuvinov (Connect2ID) </t><t>Michael Schwartz (Gluu) </t><t>Filip Skokan </t></list></t></section><section title="IANA Considerations" anchor="iana-considerations" toc="default"><section title="OAuth Dynamic Client Registration Metadata Registration" anchor="oauth-dynamic-client-registration-metadata-registration" toc="default"><t>This specification requests registration of the following client metadata definitions in the IANA "OAuth Dynamic Client Registration Metadata" registry established by [RFC7591]: </t><section title="Registry Contents" anchor="registry-contents" toc="default"><t><list style="symbols"><t>Client Metadata Name: <spanx style="verb" xml:space="preserve">authorization_signed_response_alg</spanx> </t><t>Client Metadata Description: String value indicating the client's desired introspection response signing algorithm.  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t><t>Client Metadata Name: <spanx style="verb" xml:space="preserve">authorization_encrypted_response_alg</spanx> </t><t>Client Metadata Description: String value specifying the desired introspection response encryption algorithm (alg value).  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t><t>Client Metadata Name: <spanx style="verb" xml:space="preserve">authorization_encrypted_response_enc</spanx> </t><t>Client Metadata Description: String value specifying the desired introspection response encryption algorithm (enc value).  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t></list></t></section></section><section title="OAuth Authorization Server Metadata Registration" anchor="oauth-authorization-server-metadata-registration" toc="default"><t>This specification requests registration of the following value in the IANA "OAuth Authorization Server Metadata" registry established by [RFC8414].  </t><section title="Registry Contents" anchor="registry-contents-1" toc="default"><t><list style="symbols"><t>Metadata Name: <spanx style="verb" xml:space="preserve">authorization_signing_alg_values_supported</spanx> </t><t>Metadata Description: JSON array containing a list of algorithms supported by the authorization server for introspection response signing.  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t><t>Metadata Name: <spanx style="verb" xml:space="preserve">authorization_encryption_alg_values_supported</spanx> </t><t>Metadata Description: JSON array containing a list of algorithms supported by the authorization server for introspection response encryption (alg value).  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t><t>Metadata Name: <spanx style="verb" xml:space="preserve">authorization_encryption_enc_values_supported</spanx> </t><t>Metadata Description: JSON array containing a list of algorithms supported by the authorization server for introspection response encryption (enc value).  </t><t>Change Controller: IESG </t><t>Specification Document(s): Section 5 of [[ this specification ]] </t></list></t></section></section></section><section title="Bibliography" anchor="bibliography" toc="default"><t>TBD </t></section> </middle>
  <back/>
</rfc>
