<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude"  docName="draft-ietf-oauth-access-token-jwt-13" number="9068" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" category="std" consensus="true" xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true" sortRefs="true" version="3">

  <front>
    <title abbrev="OAuth 2.0 Access Token JWT Profile">JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens</title>
    <seriesInfo name="RFC" value="9068"/>
    <author fullname="Vittorio Bertocci" initials="V." surname="Bertocci">
      <organization>Auth0</organization>
      <address>
        <email>vittorio@auth0.com</email>
      </address>
    </author>
    <date year="2021" month="October" />
    <area>Security</area>
    <workgroup>OAuth</workgroup>
    <keyword>OAuth</keyword>
    <keyword>Resource</keyword>
    <keyword>Access token</keyword>
    <keyword>JWT</keyword>
    <abstract>
      <t>
        This specification defines a profile for issuing OAuth 2.0 access tokens in JSON Web Token (JWT) format. Authorization 
servers
		and resource servers from different vendors can leverage this profile to issue and consume access tokens in an interoperable manner.  
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="Introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
  The original 
                <xref target="RFC6749" format="default">OAuth 2.0 Authorization Framework</xref> specification does not mandate any specific format for access tokens. 
  While that remains perfectly appropriate for many important scenarios, in-market use has shown that many commercial OAuth 2.0 
  implementations elected to issue access tokens using a format that can be parsed and validated by resource servers directly, without further authorization server involvement. 
  The approach is particularly common in topologies where the authorization server and resource server are not co-located, 
  are not run by the same entity, or are otherwise separated by some boundary. At the time of writing, many commercial implementations leverage the 
                <xref target="RFC7519" format="default">JSON Web Token (JWT)</xref> format.
            
      </t>
      <t>
  Many vendor-specific JWT access tokens share the same functional layout, using JWT claims to convey the information needed to support a common set of use cases: token validation, transporting authorization information in the form of scopes and entitlements,
  carrying identity information about the subject, and so on. The differences are mostly confined to the claim names and syntax 
  used to represent the same entities, suggesting that interoperability could be easily achieved by standardizing a common set of claims and validation rules.
      </t>
      <t>
  The assumption that access tokens are associated with specific information doesn't appear only in commercial implementations. 
  Various specifications in the OAuth 2.0 family (such as 
                <xref target="RFC8707" format="default">resource indicators</xref>, 
                <xref target="RFC6750" format="default">OAuth 2.0 bearer token usage</xref>, and others) postulate the presence of scoping mechanisms, such as an audience, in access tokens. 
The family of specifications associated with introspection also indirectly 
  suggests a fundamental set of information that access tokens are expected to carry or at least be associated with.			
            
      </t>
      <t>
 This specification aims to provide a standardized and interoperable profile as an alternative to the proprietary JWT access token layouts going forward. 
 Besides defining a common set of mandatory and optional claims, the profile provides clear indications on how authorization request 
 parameters determine the content of the issued JWT access token, how an authorization server can publish metadata relevant to the 
 JWT access tokens it issues, and how a resource server should validate incoming JWT access tokens.
      </t>
      <t>
  Finally, this specification provides security and privacy considerations meant to prevent common mistakes and anti-patterns 
that are likely to occur in naive use of the JWT format to represent access tokens.
      </t>
      <t indent="3">
        Please note: Although both this document and <xref target="RFC7523" format="default"/> use JSON Web Tokens in the context of the OAuth2 framework, the two specifications differ in both intent and mechanics. Whereas <xref target="RFC7523" format="default"/> defines how a JWT Bearer Token can be used to request an access token, this document describes how to encode access tokens in JWT format.
      </t>
      <section anchor="RNC" numbered="true" toc="default">
        <name>Requirements Notation and Conventions</name>
        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>
      </section>
      <section anchor="Terminology" numbered="true" toc="default">
        <name>Terminology</name>
        <dl newline="false" spacing="normal">
          <dt>JWT access token:</dt>
          <dd>							
        An OAuth 2.0 access token encoded in JWT format and complying with the requirements described in this specification.
						</dd>
        </dl>
        <t>
        This specification uses the terms
        "access token",
        "refresh token",
        "authorization server",
        "resource server",
        "authorization endpoint",
        "authorization request",
        "authorization response",
        "token endpoint",
        "grant type",
        "access token request",
        "access token response",
        and "client"
        defined by  
                    <xref target="RFC6749" format="default">The OAuth 2.0 Authorization Framework</xref>.
        </t>
      </section>
    </section>
    <section anchor="JWTATLayout" numbered="true" toc="default">
      <name>JWT Access Token Header and Data Structure</name>
      <section anchor="JWTATHeader" numbered="true" toc="default">
        <name>Header</name>
        <t>
				JWT access tokens <bcp14>MUST</bcp14> be signed. Although JWT access tokens can use any signing algorithm, use of asymmetric cryptography is <bcp14>RECOMMENDED</bcp14> as it simplifies the process of acquiring validation information for resource servers (see 
                    <xref target="JWTATLValidate" format="default"/>). JWT access tokens <bcp14>MUST NOT</bcp14> use "none" as the signing algorithm. See 
                    <xref target="JWTATLValidate" format="default"/> for more details.
                
        </t>
        <t>
                Authorization servers and resource servers conforming to this specification <bcp14>MUST</bcp14> include RS256 (as defined in <xref target="RFC7518" format="default"/>) among their supported signature algorithms.  
        </t>
        <t>
            
This specification registers the "application/at+jwt" media type, which can be used to indicate that the content is a JWT access token. 
   JWT access tokens <bcp14>MUST</bcp14> include this media type in the "typ" header parameter to explicitly declare that the JWT represents an access token complying with this profile.
   Per the definition of "typ" in <xref target="RFC7515" sectionFormat="of" section="4.1.9"/>, it is <bcp14>RECOMMENDED</bcp14> that the "application/" prefix be omitted.  Therefore, the "typ" value used <bcp14>SHOULD</bcp14> be "at+jwt".
 See the <xref target="SecurityConsiderations" format="title"/> section for details on the importance of preventing OpenID Connect ID Tokens (as defined by Section 2 of <xref target="OpenID.Core" format="default"/>) from being accepted as access tokens by resource servers implementing this profile.
				
        </t>
      </section>
      <section anchor="JWTATDataStructure" numbered="true" toc="default">
        <name>Data Structure</name>
        <t>
				The following claims are used in the JWT access token data structure.
        </t>
        <dl newline="false" spacing="normal">
          <dt>iss</dt>
          <dd>
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519" sectionFormat="of" section="4.1.1"/>.						
                        
                        </dd>
          <dt>exp</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519" sectionFormat="of" section="4.1.4"/>.						
                        
                        </dd>
          <dt>aud</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519"  sectionFormat="of" section="4.1.3"/>. See 
                            <xref target="JWTATLRequest" format="default"/> for indications on how an authorization server should determine the value of "aud" depending on the request.					 						
                        
                        </dd>
          <dt>sub</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519"  sectionFormat="of" section="4.1.2"/>. In cases of access tokens obtained through grants where a resource owner is involved, such as the authorization code grant, the value of "sub" <bcp14>SHOULD</bcp14> correspond to the subject identifier of the resource owner. In cases of access tokens obtained through grants where no resource owner is involved, such as the client credentials grant, the value of "sub" <bcp14>SHOULD</bcp14> correspond to an identifier the authorization server uses to indicate the client application. 
                            See 
                            <xref target="SecurityConsiderations" format="default"/> for more details on this scenario. Also, see 
                            <xref target="PrivacyConsiderations" format="default"/> for a discussion about how different choices in assigning "sub" values can impact privacy. 
                        
                        </dd>
          <dt>client_id</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC8693"  sectionFormat="of" section="4.3"/>.
                        
                        </dd>
          <dt>iat</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519" sectionFormat="of" section="4.1.6"/>.
						This claim identifies the time at which the JWT access token was issued.                         
                        
                        </dd>
          <dt>jti</dt>
          <dd>							
        <bcp14>REQUIRED</bcp14> - as defined in <xref target="RFC7519"  sectionFormat="of" section="4.1.7"/>.
                        
                        </dd>
        </dl>
        <section anchor="AuthenticationInfoClaims" numbered="true" toc="default">
          <name>Authentication Information Claims</name>
          <t>The claims listed in this section <bcp14>MAY</bcp14> be issued in the context of authorization grants involving the resource owner and reflect the types and strength of authentication in the access token that the authentication server enforced prior to returning the authorization response to the client. Their values are fixed and remain the same across all access tokens that derive from a given authorization response, whether the access token was obtained directly 
                        in the response (e.g., via the implicit flow) or after one or more token exchanges (e.g., obtaining a fresh access token using a refresh token or exchanging one access token for another via 
                        <xref target="RFC8693" format="default"/> procedures). 
                        
          </t>
          <dl newline="false" spacing="normal">
            <dt>auth_time</dt>
            <dd>							
									<bcp14>OPTIONAL</bcp14> - as defined in Section 2 of 
                                <xref target="OpenID.Core" format="default"/>.
                            
                            </dd>
            <dt>acr</dt>
            <dd>							
									<bcp14>OPTIONAL</bcp14> - as defined in Section 2 of 
                                <xref target="OpenID.Core" format="default"/>. 
                            
                            </dd>
            <dt>amr</dt>
            <dd>							
									<bcp14>OPTIONAL</bcp14> - as defined in Section 2 of 
                                <xref target="OpenID.Core" format="default"/>. 
                            
                            </dd>
          </dl>
        </section>
        <section anchor="IdentityClaims" numbered="true" toc="default">
          <name>Identity Claims</name>
          <t>
					In the context of authorization grants involving the resource owner, commercial authorization servers will often include resource owner attributes directly in access tokens so that resource servers can consume them directly for authorization or other purposes without any further round trips to introspection (<xref target="RFC7662" format="default"/>) or UserInfo (<xref target="OpenID.Core" format="default"/>) endpoints.
					This is particularly common in scenarios where the client and the resource server belong to the same entity and are part of the same solution, as is the case for first-party clients invoking their own backend API.
					
                    
                    
                    
          </t>
          <t>This profile does not introduce any mechanism for a client to directly request the presence of specific claims in JWT access tokens, as the authorization server can determine what additional claims are required by a particular resource server by taking the client_id of the client and the "scope" and the "resource" parameters included in the request into consideration.</t>
          <t>
                    Any additional identity attribute whose semantic is well described by an entry in the "JSON Web Token (JWT)" IANA registry introduced in <xref target="RFC7519" format="default"/> <bcp14>SHOULD</bcp14> be encoded using the corresponding claim name, if that attribute is to be included in the JWT access token. Note that the JWT IANA registry includes the claims found in Section 5.1 of <xref target="OpenID.Core" format="default"/>.
          </t>
          <t>Authorization servers <bcp14>MAY</bcp14> return arbitrary attributes not defined in any existing specification, as long as the corresponding claim names are collision resistant or the access tokens are meant to be used only within a private subsystem. Please refer to Sections <xref target="RFC7519" sectionFormat="bare" section="4.2"/> and <xref target="RFC7519" sectionFormat="bare" section="4.3"/> of <xref target="RFC7519"/> for details.
          </t>
          <t>Authorization servers including resource owner attributes in JWT access tokens need to exercise care and verify that all privacy requirements are met, as discussed in 
                        
                        
                        
                        <xref target="PrivacyConsiderations" format="default"/>.
                    
                    
                    
          </t>
        </section>
        <section anchor="AuthorizationClaims" numbered="true" toc="default">
          <name>Authorization Claims</name>
          <t>
					If an authorization request includes a scope parameter, the corresponding issued JWT access token <bcp14>SHOULD</bcp14> include a "scope" claim as defined in  <xref target="RFC8693" sectionFormat="of" section="4.2"/>.
                    
          </t>
          <t>
					All the individual scope strings in the "scope" claim <bcp14>MUST</bcp14> have meaning for the resources indicated in the "aud" claim. See 
                        <xref target="SecurityConsiderations" format="default"/> for more considerations about the relationship between scope strings and resources indicated by the "aud" claim.
					
          </t>
          <section anchor="NDAuthorizationClaims" numbered="true" toc="default">
            <name>Claims for Authorization Outside of Delegation Scenarios</name>
            <t>
						Many authorization servers embed authorization attributes that go beyond the delegated scenarios described by 
                            <xref target="RFC7519" format="default"/> in the access tokens they issue. Typical examples include resource owner memberships in roles and groups that are relevant to the resource being accessed, entitlements assigned to the resource owner for the targeted resource that the authorization server knows about, and so on.
                        
            </t>
            <t>
An authorization server wanting to include such attributes in a JWT access token <bcp14>SHOULD</bcp14> use the "groups", "roles", and "entitlements" attributes of the "User" resource schema defined by <xref target="RFC7643" sectionFormat="of" section="4.1.2"/>) as claim types. 
</t>
            <t>
Authorization servers <bcp14>SHOULD</bcp14> encode the corresponding claim values according to the guidance defined in <xref target="RFC7643" format="default"/>. In particular, a non-normative example of a "groups" attribute can be found in <xref target="RFC7643" sectionFormat="of" section="8.2"/>. No specific vocabulary is provided for "roles" and "entitlements".
</t>
            <t>
                            <xref target="IANAClaimsContent" format="default"/> of this document provides entries for registering "groups", "roles", and "entitlements" attributes from 
                            <xref target="RFC7643" format="default"/> as claim types to be used in this profile.   
                        
            </t>
          </section>
        </section>
      </section>
    </section>
    <section anchor="JWTATLRequest" numbered="true" toc="default">
      <name>Requesting a JWT Access Token</name>
      <t>
			An authorization server can issue a JWT access token in response to any authorization grant defined by 
                <xref target="RFC6749" format="default"/> and subsequent extensions meant to result in an access token.
            
      </t>
      <t>If the request includes a "resource" parameter (as defined in 
                <xref target="RFC8707" format="default"/>), the resulting JWT access token "aud" claim <bcp14>SHOULD</bcp14> have the same value as the "resource" parameter in the request. 
            
      </t>
      <t>Example request below:</t>
      <figure anchor="authz-endpoint-example-code">
        <name>Authorization Request with Resource and Scope Parameters</name>

        <sourcecode name="" type=""><![CDATA[
GET /as/authorization.oauth2?response_type=code
        &client_id=s6BhdRkqt3
        &state=xyz
        &scope=openid%20profile%20reademail
        &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
        &resource=https%3A%2F%2Frs.example.com%2F HTTP/1.1
     Host: authorization-server.example.com
]]></sourcecode>
      </figure>
      <t>
		Once redeemed, the code obtained from the request above will result in a JWT access token in the form shown below:
      </t>
      <figure anchor="jwt-at-example-code">
        <name>The Header and JWT Claims Set of a JWT Access Token</name>
        <sourcecode name="" type="json"><![CDATA[
Header:
 
   {"typ":"at+JWT","alg":"RS256","kid":"RjEwOwOA"}
 
Claims:
 
   {
     "iss": "https://authorization-server.example.com/",
     "sub": "5ba552d67",
     "aud":   "https://rs.example.com/",
     "exp": 1639528912,
     "iat": 1618354090,
     "jti" : "dbe39bf3a3ba4238a513f51d6e1691c4",
     "client_id": "s6BhdRkqt3",
     "scope": "openid profile reademail"
   }
]]></sourcecode>
      </figure>
      <t>
		The authorization server <bcp14>MUST NOT</bcp14> issue a JWT access token if the authorization granted by the token would be ambiguous.  
		See 
                <xref target="SecurityConsiderations" format="default"/> for more details about common cases that might lead to ambiguity and strategies an authorization server can enact to prevent them.
      </t>
      <t>
		If the request does not include a "resource" parameter, the authorization server <bcp14>MUST</bcp14> use a default resource indicator in the "aud" claim. If a "scope" parameter is present in the request, the authorization server <bcp14>SHOULD</bcp14> use it to infer the value of the default resource indicator to be used in the "aud" claim. The mechanism through which scopes are associated with default resource indicator values is outside the scope of this specification. If the values in the "scope" parameter refer to different default resource indicator values, the authorization server <bcp14>SHOULD</bcp14> reject the request with "invalid_scope" as described in <xref target="RFC6749" sectionFormat="of" section="4.1.2.1"/>.
			
            
            
            
      </t>
    </section>
    <section anchor="JWTATLValidate" numbered="true" toc="default">
      <name>Validating JWT Access Tokens</name>
      <t>
			For the purpose of facilitating validation data retrieval, it is <bcp14>RECOMMENDED</bcp14> here that authorization servers sign JWT access tokens with an asymmetric algorithm.
      </t>
      <t>
			Authorization servers <bcp14>SHOULD</bcp14> use 
                <xref target="RFC8414" format="default">OAuth 2.0 Authorization Server Metadata</xref> to advertise to resource servers their signing keys via "jwks_uri" and what "iss" claim value to expect 
                via the "issuer" metadata value. Alternatively, authorization servers implementing OpenID Connect <bcp14>MAY</bcp14> use the <xref target="OpenID.Discovery" format="default">OpenID Connect discovery</xref> document for the same purpose. If an authorization server supports both OAuth 2.0 Authorization Server Metadata and OpenID Connect discovery, the values provided <bcp14>MUST</bcp14> be consistent across the two publication methods.
      </t>
      <t>
			An authorization server <bcp14>MAY</bcp14> elect to use different keys to sign OpenID Connect ID Tokens and JWT access tokens. This specification does not provide a mechanism for identifying a specific key as the one used to sign JWT access tokens. An authorization server can sign JWT access tokens with any of the keys advertised via authorization server (AS) metadata or OpenID Connect discovery. See 
                <xref target="SecurityConsiderations" format="default"/> for further guidance on security implications.   
			
      </t>
      <t>
			Resource servers receiving a JWT access token <bcp14>MUST</bcp14> validate it in the following manner.
      </t>
      <ul spacing="normal">
        <li>							
The resource server <bcp14>MUST</bcp14> verify that the "typ" header value is "at+jwt" or "application/at+jwt" and reject tokens carrying any other value.
					</li>
        <li>
If the JWT access token is encrypted, decrypt it using the keys and algorithms that the resource server specified during registration. If encryption was negotiated with the authorization server at registration time and the incoming JWT access token is not encrypted, the resource server <bcp14>SHOULD</bcp14> reject it.					
					</li>
        <li>
The issuer identifier for the authorization server (which is typically obtained during discovery) <bcp14>MUST</bcp14> exactly match the value of the "iss" claim.					
					</li>
        <li>
The resource server <bcp14>MUST</bcp14> validate that the "aud" claim contains a resource indicator value corresponding to an identifier the resource server expects for itself. The JWT access token <bcp14>MUST</bcp14> be rejected if "aud" does not contain a resource indicator of the current resource server as a valid audience.					
					</li>
        <li>
The resource server <bcp14>MUST</bcp14> validate the signature of all incoming JWT access tokens according to 
                        
                        
                        
                        <xref target="RFC7515" format="default"/> using the algorithm specified in the JWT "alg" Header Parameter. The resource server <bcp14>MUST</bcp14> reject any JWT in which the value of "alg" is "none". The resource server <bcp14>MUST</bcp14> use the keys provided by the authorization server.  
					
                    
                    
                    
                    </li>
        <li>
The current time <bcp14>MUST</bcp14> be before the time represented by the "exp" claim. Implementers <bcp14>MAY</bcp14> provide for some small leeway, usually no more than a few minutes, to account for clock skew.					
					</li>
      </ul>
      <t>
            The resource server <bcp14>MUST</bcp14> handle errors as described in <xref target="RFC6750" sectionFormat="of" section="3.1"/>. In particular, in case of any failure in the validation checks listed above, the authorization server response <bcp14>MUST</bcp14> include the error code "invalid_token".

                Please note that this requirement does not prevent JWT access tokens from using authentication schemes other than "Bearer".
            
      </t>
      <t>			
If the JWT access token includes authorization claims as described in 
                <xref target="AuthorizationClaims" format="default"/>, the resource server <bcp14>SHOULD</bcp14> use them in combination with any other contextual information available to determine whether the current call should be authorized or rejected. Details about how a resource server performs those checks is beyond the scope of this profile specification.
			
      </t>
    </section>
    <section anchor="SecurityConsiderations" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>
			The JWT access token data layout described here is very similar to that of the id_token as defined by 
                <xref target="OpenID.Core" format="default"/>. The explicit typing required in this profile, in line with the recommendations in 
                <xref target="RFC8725" format="default"/>, helps the resource server to distinguish between JWT access tokens and OpenID Connect ID Tokens. 
            
      </t>
      <t>
			Authorization servers should prevent scenarios where clients can affect the value of the "sub" claim in ways that could confuse resource servers. 
            For example, if the authorization server elects to use the client_id as the "sub" value for access tokens issued using the client credentials grant, the authorization server should prevent clients from registering an arbitrary client_id value, as this would allow malicious clients to select the sub of a high-privilege resource owner and confuse any authorization logic on the resource server relying on the "sub" value.       
			For more details, please refer to <xref target="I-D.ietf-oauth-security-topics" sectionFormat="of" section="4.14"/>.
            
      </t>
      <t>
To prevent cross-JWT confusion, authorization servers <bcp14>MUST</bcp14> use a distinct identifier as an "aud" claim value to uniquely identify access tokens issued by the same issuer for distinct resources. For more details on cross-JWT confusion, please refer to <xref target="RFC8725" sectionFormat="of" section="2.8"/>. 
			
      </t>
      <t>
			Authorization servers should use particular care when handling requests that might lead to ambiguous authorization grants. For example, if a request includes multiple resource indicators, the authorization server should ensure that each scope string included in the resulting JWT access token, if any, can be unambiguously correlated to a specific resource among the ones listed in the "aud" claim. The details on how to recognize and mitigate this and other ambiguous situations is highly scenario dependent and hence is out of scope for this profile.
      </t>
      <t>
            Authorization servers cannot rely on the use of different keys for signing OpenID Connect ID Tokens and JWT tokens as a method to safeguard against the consequences of leaking specific keys. Given that resource servers have no way of knowing what key should be used to validate JWT access tokens in particular, they have to accept signatures performed with any of the keys published in AS metadata or OpenID Connect discovery; consequently, an attacker just needs to compromise any key among the ones published to be able to generate and sign JWTs that will be accepted as valid by the resource server.  
      </t>
    </section>
    <section anchor="PrivacyConsiderations" numbered="true" toc="default">
      <name>Privacy Considerations</name>
      <t>
			 As JWT access tokens carry information by value, it now becomes possible for clients and potentially even end users to directly peek inside the token claims collection of unencrypted tokens.
            
      </t>
      <t>
			The client <bcp14>MUST NOT</bcp14> inspect the content of the access token: the authorization server and the resource server might decide to change the token format at any time (for example, by switching from this profile to opaque tokens); hence, any logic in the client relying on the ability to read the access token content would break without recourse. 
            The OAuth 2.0 framework assumes that access tokens are treated as opaque by clients. 
			Administrators of authorization servers should also take into account that the content of an access token is visible to the client. 
            Whenever client access to the access token content presents privacy issues for a given scenario, the authorization server needs to take explicit steps to prevent them.   
      </t>
      <t>
			In scenarios in which JWT access tokens are accessible to the end user, it should be evaluated whether the information can be accessed without privacy violations (for example, if an end user would simply access his or her own personal information) or if steps must be taken to enforce confidentiality.
      </t>
      <t>
            Possible measures to prevent leakage of information to clients and end users include: encrypting the access token, encrypting the sensitive claims, omitting the sensitive claims or not using this profile, and falling back on opaque access tokens.
      </t>
      <t>
			In every scenario, the content of the JWT access token will eventually be accessible to the resource server. It's important to evaluate whether 
			the resource server gained the proper entitlement to have access to any content received in the form of claims, for example, through user consent 
			in some form, policies and agreements with the organization running the authorization servers, and so on. 
            For example, a user might not wish to consent to granting given resource server information about any of the non-mandatory claims enumerated in <xref target="JWTATLayout" format="default"/> (and its subsections). 
      </t>
      <t>
             This profile mandates the presence of the "sub" claim in every JWT access token, making it possible for resource servers to rely on that information for correlating incoming requests with data stored locally for the authenticated principal. 
             Although the ability to correlate requests might be required by design in many scenarios, there are scenarios where the authorization server might want to prevent correlation. The "sub" claim should be populated by the authorization servers according to a privacy impact assessment.
             For instance, if a solution requires preventing tracking of principal activities across multiple resource servers, the authorization server should ensure that JWT access tokens meant for different resource servers have distinct "sub" values that cannot be correlated in the event of resource server collusion.  
             Similarly, if a solution requires preventing a resource server from correlating the principal's activity within the resource itself, the authorization server should assign different "sub" values for every JWT access token issued. 
             In turn, the client should obtain a new JWT access token for every call to the resource server to ensure that the resource server receives different "sub" and "jti" values at every call, thus preventing correlation between distinct requests.
      </t>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section anchor="IANAMediaTypes" numbered="true" toc="default">
        <name>Media Type Registration</name>
        <section anchor="IANAMediaTypesContent" numbered="true" toc="default">
          <name>Registry Content</name>
	            <t>
	    This section registers "application/at+jwt", a new media type <xref target="RFC2046" format="default"/> in the "Media Types" registry <xref target="IANA.MediaTypes"/> in the
   manner described in <xref target="RFC6838" format="default"/>. It can be used to indicate that the
   content is an access token encoded in JWT format.
		                
          </t>
<dl spacing="normal">
            <dt>Type name:</dt><dd> Application</dd>
            <dt>Subtype name:</dt><dd>at+jwt</dd>
            <dt>Required parameters:</dt><dd>N/A</dd>
            <dt>Optional parameters:</dt><dd>N/A</dd>
            <dt>Encoding considerations:</dt><dd> Binary; JWT values are
      encoded as a series of base64url-encoded values (with trailing '='
      characters removed), some of which may be the empty string,
      separated by period ('.') characters.</dd>
            <dt>Security considerations:</dt><dd> See the Security Considerations section of RFC 9068.</dd>
            <dt>Interoperability considerations:</dt><dd>N/A</dd>
            <dt>Published specification:</dt><dd>RFC 9068</dd>
            <dt>Applications that use this media type:</dt><dd> Applications that access resource servers using OAuth 2.0 access tokens encoded in JWT format</dd>
            <dt>Fragment identifier considerations:</dt><dd>N/A</dd>

<dt>Additional information:</dt>
<dd><t><br/></t>
  <dl spacing="compact" newline="false">
    <dt>Magic number(s):</dt><dd>N/A</dd>
    <dt>File extension(s):</dt><dd>N/A</dd>
    <dt>Macintosh file type code(s):</dt><dd>N/A</dd>
  </dl>
</dd>
            <dt>Person &amp; email address to contact for further information:</dt>
	    <dd><t><br/>Vittorio Bertocci &lt;vittorio@auth0.com&gt;</t></dd>

            <dt>Intended usage:</dt><dd> COMMON</dd>
            <dt>Restrictions on usage:</dt><dd> None</dd>
            <dt>Author:</dt><dd>Vittorio Bertocci &lt;vittorio@auth0.com&gt;</dd>
            <dt>Change controller:</dt><dd>IETF</dd>
            <dt>Provisional registration?</dt><dd>No</dd>
          </dl>
        </section>
      </section>
      <section anchor="IANAClaimTypes" numbered="true" toc="default">
        <name>Claims Registration</name>
        <t>
                        <xref target="NDAuthorizationClaims" format="default"/> of this specification refers to the attributes "roles", "groups", "entitlements" defined in 
                        <xref target="RFC7643" format="default"/> to express authorization information in JWT access tokens.
			This section registers those attributes as claims in the "JSON Web Token (JWT)" IANA registry introduced in 
                        <xref target="RFC7519" format="default"/>.
            
        </t>
        <section anchor="IANAClaimsContent" numbered="true" toc="default">
          <name>Registry Content</name>
          <section anchor="IANARoles" numbered="true" toc="default">
            <name>Roles</name>
            <dl spacing="compact" newline="false">
              <dt>Claim Name:</dt><dd>roles</dd>
              <dt>Claim Description:</dt><dd> Roles</dd>
              <dt>Change Controller:</dt><dd>IETF</dd>
              <dt>Specification Document(s):</dt><dd> <xref target="RFC7643" sectionFormat="of" section="4.1.2"/> and <xref target="NDAuthorizationClaims" format="default"/> of RFC 9068</dd>
            </dl>
          </section>
          <section anchor="IANAGroups" numbered="true" toc="default">
            <name>Groups</name>
            <dl spacing="compact" newline="false">
              <dt>Claim Name:</dt><dd> groups</dd>
              <dt>Claim Description:</dt><dd>Groups</dd>
              <dt>Change Controller:</dt><dd>IETF</dd>
              <dt>Specification Document(s):</dt><dd> <xref target="RFC7643" sectionFormat="of" section="4.1.2"/> and <xref target="NDAuthorizationClaims" format="default"/> of RFC 9068</dd>
            </dl>
          </section>
          <section anchor="IANAEntitlements" numbered="true" toc="default">
            <name>Entitlements</name>
            <dl spacing="compact" newline="false">
              <dt>Claim Name:</dt><dd> entitlements</dd>
              <dt>Claim Description:</dt><dd> Entitlements</dd>
              <dt>Change Controller:</dt><dd>IETF</dd>
              <dt>Specification Document(s):</dt><dd> <xref target="RFC7643" sectionFormat="of" section="4.1.2"/> and <xref target="NDAuthorizationClaims" format="default"/> of RFC 9068</dd>
            </dl>
          </section>
        </section>
      </section>
    </section>
  </middle>
  <back>

<displayreference target="I-D.ietf-oauth-security-topics" to="OAuth2.Security.BestPractices"/>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7643.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7515.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8414.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2046.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6838.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8693.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8707.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8725.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7518.xml"/>

        <reference anchor="OpenID.Core" target="https://openid.net/specs/openid-connect-core-1_0.html">
          <front>
            <title>OpenID Connect Core 1.0 incorporating errata set 1</title>
            <author initials="N" surname="Sakimura" fullname="Nat Sakimura">
              <organization/>
            </author>
            <author initials="J" surname="Bradley" fullname="John Bradley">
              <organization/>
            </author>
            <author initials="M" surname="Jones" fullname="Mike Jones">
              <organization/>
            </author>
            <author initials="B" surname="de Medeiros" fullname="Breno de Medeiros">
              <organization/>
            </author>
            <author initials="C" surname="Mortimore" fullname="Chuck Mortimore">
              <organization/>
            </author>
            <date month="November" year="2014"/>
          </front>
        </reference>

        <reference anchor="OpenID.Discovery" target="https://openid.net/specs/openid-connect-discovery-1_0.html">
          <front>
            <title>OpenID Connect Discovery 1.0 incorporating errata set 1</title>
            <author initials="N" surname="Sakimura" fullname="Nat Sakimura">
              <organization/>
            </author>
            <author initials="J" surname="Bradley" fullname="John Bradley">
              <organization/>
            </author>
            <author initials="M" surname="Jones" fullname="Mike Jones">
              <organization/>
            </author>
            <author initials="E" surname="Jay" fullname="Edmund Jay">
              <organization/>
            </author>
            <date month="November" year="2014"/>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>

        <reference anchor="IANA.MediaTypes" target="https://www.iana.org/assignments/media-types/">
          <front>
            <title>Media Types</title>
	    <author><organization>IANA</organization></author>
            <date/>
          </front>
        </reference>

        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7662.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6750.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7523.xml"/>

<xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-oauth-security-topics.xml"/>

      </references>
    </references>
    <section anchor="Acknowledgements" numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>
        The initial set of requirements informing this specification was extracted by numerous examples of access tokens issued in JWT format by production systems.
Thanks to <contact fullname="Dominick Baier"/> (IdentityServer), <contact fullname="Brian Campbell"/> (Ping Identity), <contact fullname="Daniel Dobalian"/> (Microsoft), and <contact fullname="Karl Guinness"/> (Okta) for providing sample tokens issued by their products and services.		
		<contact fullname="Brian Campbell"/> and <contact fullname="Filip Skokan"/> provided early feedback that shaped the direction of the specification.
		This profile was discussed at length during the OAuth Security Workshop 2019, with several individuals contributing ideas and feedback. The author would like to acknowledge the contributions of:</t>
      <t>
        <contact fullname="John Bradley"/>,
	<contact fullname="Brian Campbell"/>,
	<contact fullname="Vladimir Dzhuvinov"/>,
        <contact fullname="Torsten Lodderstedt"/>,
        <contact fullname="Nat Sakimura"/>,
	<contact fullname="Hannes Tschofenig"/>,         
        and
        everyone who actively participated in the unconference discussions.
      </t>

      <t>
			The following individuals contributed useful feedback and insights on the drafts, both at the IETF OAuth 2.0 WG mailing list and during the 28th Internet Identity Workshop (IIW 28):
      </t>
      <t>
        <contact fullname="Dale Olds"/>,
	<contact fullname="George Fletcher"/>,
	<contact fullname="David Waite"/>,
        <contact fullname="Michael Engan"/>,
        <contact fullname="Mike Jones"/>,
        <contact fullname="Hans Zandbelt"/>,
        <contact fullname="Vladimir Dzhuvinov"/>,
        <contact fullname="Martin Schanzenbach"/>,
	<contact fullname="Aaron Parecki"/>,
	<contact fullname="Annabelle Richard Backman"/>,
        <contact fullname="Dick Hardt"/>,
        <contact fullname="Denis Pinkas"/>,
        <contact fullname="Benjamin Kaduk"/>,
        <contact fullname="Dominick Baier"/>,
        <contact fullname="Andrii Deinega"/>,
        <contact fullname="Mike Jones"/>, 		
        and
        everyone who actively participated in the IIW 28 unconference discussions and the IETF OAuth 2.0 WG mailing list discussions.
        Thanks to <contact fullname="Roman Danyliw"/> for the AD review; <contact fullname="Joseph Salowey"/> and <contact fullname="Roni Even"/> for the SECDIR and GENART reviews; and <contact fullname="Francesca Palomini"/>, <contact fullname="Lars Eggert"/>, <contact fullname="Murray Kucherawy"/>, <contact fullname="Roberto Polli"/>, <contact fullname="Martin Duke"/>, <contact fullname="Benjamin Kaduk"/> for the IESG reviews.
      </t>
    </section>
</back>
</rfc>
