< draft-jones-json-web-token-09.txt   draft-jones-json-web-token-10.txt >
Network Working Group M. Jones Network Working Group M. Jones
Internet-Draft Microsoft Internet-Draft Microsoft
Intended status: Standards Track D. Balfanz Intended status: Standards Track D. Balfanz
Expires: November 9, 2012 Google Expires: November 13, 2012 Google
J. Bradley J. Bradley
independent Ping Identity
Y. Goland Y. Goland
Microsoft Microsoft
J. Panzer J. Panzer
Google Google
N. Sakimura N. Sakimura
Nomura Research Institute NRI
P. Tarjan P. Tarjan
Facebook Facebook
May 8, 2012 May 12, 2012
JSON Web Token (JWT) JSON Web Token (JWT)
draft-jones-json-web-token-09 draft-jones-json-web-token-10
Abstract Abstract
JSON Web Token (JWT) is a means of representing claims to be JSON Web Token (JWT) is a means of representing claims to be
transferred between two parties. The claims in a JWT are encoded as transferred between two parties. The claims in a JWT are encoded as
a JSON object that is digitally signed or HMACed using JSON Web a JSON object that is digitally signed or MACed using JSON Web
Signature (JWS) and/or encrypted using JSON Web Encryption (JWE). Signature (JWS) and/or encrypted using JSON Web Encryption (JWE).
The suggested pronunciation of JWT is the same as the English word The suggested pronunciation of JWT is the same as the English word
"jot". "jot".
Requirements Language Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
skipping to change at page 2, line 7 skipping to change at page 2, line 7
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 9, 2012. This Internet-Draft will expire on November 13, 2012.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2012 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 3, line 10 skipping to change at page 3, line 10
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . 5 3. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . 5
3.1. Example JWT . . . . . . . . . . . . . . . . . . . . . . . 5 3.1. Example JWT . . . . . . . . . . . . . . . . . . . . . . . 6
4. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1. Reserved Claim Names . . . . . . . . . . . . . . . . . . . 7 4.1. Reserved Claim Names . . . . . . . . . . . . . . . . . . . 7
4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 9 4.1.1. "exp" (Expiration Time) Claim . . . . . . . . . . . . 7
4.1.2. "nbf" (Not Before) Claim . . . . . . . . . . . . . . . 7
4.1.3. "iat" (Issued At) Claim . . . . . . . . . . . . . . . 7
4.1.4. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . . 8
4.1.5. "aud" (Audience) Claim . . . . . . . . . . . . . . . . 8
4.1.6. "prn" (Principal) Claim . . . . . . . . . . . . . . . 8
4.1.7. "jti" (JWT ID) Claim . . . . . . . . . . . . . . . . . 8
4.1.8. "typ" (Type) Claim . . . . . . . . . . . . . . . . . . 8
4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 8
4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 9 4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 9
5. JWT Header . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5. JWT Header . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6. Plaintext JWTs . . . . . . . . . . . . . . . . . . . . . . . . 11 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 10
6.1. Example Plaintext JWT . . . . . . . . . . . . . . . . . . 11 6. Plaintext JWTs . . . . . . . . . . . . . . . . . . . . . . . . 10
7. Rules for Creating and Validating a JWT . . . . . . . . . . . 12 6.1. Example Plaintext JWT . . . . . . . . . . . . . . . . . . 10
8. Cryptographic Algorithms . . . . . . . . . . . . . . . . . . . 14 7. Rules for Creating and Validating a JWT . . . . . . . . . . . 11
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 8. Cryptographic Algorithms . . . . . . . . . . . . . . . . . . . 13
9.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 15 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13
9.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 14
9.2. Sub-Namespace Registration of 9.2. Sub-Namespace Registration of
urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 15 urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 14
9.3. Registration of application/jwt MIME Media Type . . . . . 15 9.3. Registration of application/jwt MIME Media Type . . . . . 14
10. Security Considerations . . . . . . . . . . . . . . . . . . . 17 9.4. Registration of "JWT" Type Value . . . . . . . . . . . . . 15
10.1. Unicode Comparison Security Issues . . . . . . . . . . . . 17 10. Security Considerations . . . . . . . . . . . . . . . . . . . 16
11. Open Issues and Things To Be Done (TBD) . . . . . . . . . . . 18 11. Open Issues and Things To Be Done (TBD) . . . . . . . . . . . 16
12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 16
12.1. Normative References . . . . . . . . . . . . . . . . . . . 18 12.1. Normative References . . . . . . . . . . . . . . . . . . . 16
12.2. Informative References . . . . . . . . . . . . . . . . . . 19 12.2. Informative References . . . . . . . . . . . . . . . . . . 17
Appendix A. Relationship of JWTs to SAML Tokens . . . . . . . . . 20 Appendix A. Relationship of JWTs to SAML Tokens . . . . . . . . . 18
Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs) . . 20 Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs) . . 18
Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 21 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 18
Appendix D. Document History . . . . . . . . . . . . . . . . . . 21 Appendix D. Document History . . . . . . . . . . . . . . . . . . 19
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 23 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 21
1. Introduction 1. Introduction
JSON Web Token (JWT) is a compact token format intended for space JSON Web Token (JWT) is a compact token format intended for space
constrained environments such as HTTP Authorization headers and URI constrained environments such as HTTP Authorization headers and URI
query parameters. JWTs encode claims to be transmitted as a JSON query parameters. JWTs encode claims to be transmitted as a JSON
object (as defined in RFC 4627 [RFC4627]) that is base64url encoded object (as defined in RFC 4627 [RFC4627]) that is base64url encoded
and digitally signed or HMACed and/or encrypted. Signing and HMACing and digitally signed or MACed and/or encrypted. Signing and MACing
is performed using JSON Web Signature (JWS) [JWS]. Encryption is is performed using JSON Web Signature (JWS) [JWS]. Encryption is
performed using JSON Web Encryption (JWE) [JWE]. performed using JSON Web Encryption (JWE) [JWE].
The suggested pronunciation of JWT is the same as the English word The suggested pronunciation of JWT is the same as the English word
"jot". "jot".
2. Terminology 2. Terminology
JSON Web Token (JWT) A string consisting of multiple parts, the JSON Web Token (JWT) A string consisting of multiple parts, the
first being the Encoded JWT Header, plus additional parts first being the Encoded JWT Header, plus additional parts
depending upon the contents of the header, with the parts being depending upon the contents of the header, with the parts being
separated by period ('.') characters, and each part containing separated by period ('.') characters, and each part containing
base64url encoded content. base64url encoded content.
JWT Header A string representing a JSON object that describes the JWT Header A string representing a JSON object that describes the
cryptographic operations applied to the JWT. When the JWT is cryptographic operations applied to the JWT. When the JWT is
digitally signed or HMACed, the JWT Header is a JWS Header. When digitally signed or MACed, the JWT Header is a JWS Header. When
the JWT is encrypted, the JWT Header is a JWE Header. the JWT is encrypted, the JWT Header is a JWE Header.
Header Parameter Names The names of the members within the JWT Header Parameter Names The names of the members within the JWT
Header. Header.
Header Parameter Values The values of the members within the JWT Header Parameter Values The values of the members within the JWT
Header. Header.
JWT Claims Set A string representing a JSON object that contains the JWT Claims Set A string representing a JSON object that contains the
claims conveyed by the JWT. When the JWT is digitally signed or claims conveyed by the JWT. When the JWT is digitally signed or
HMACed, the bytes of the UTF-8 representation of the JWT Claims MACed, the bytes of the UTF-8 representation of the JWT Claims Set
Set are base64url encoded to create the Encoded JWS Payload. When are base64url encoded to create the Encoded JWS Payload. When the
the JWT is encrypted, the bytes of the UTF-8 representation of the JWT is encrypted, the bytes of the UTF-8 representation of the JWT
JWT Claims Set are used as the JWE Plaintext. Claims Set are used as the JWE Plaintext.
Claim Names The names of the members of the JSON object represented Claim Names The names of the members of the JSON object represented
by the JWT Claims Set. by the JWT Claims Set.
Claim Values The values of the members of the JSON object Claim Values The values of the members of the JSON object
represented by the JWT Claims Set. represented by the JWT Claims Set.
Encoded JWT Header Base64url encoding of the bytes of the UTF-8 RFC Encoded JWT Header Base64url encoding of the bytes of the UTF-8 RFC
3629 [RFC3629] representation of the JWT Header. 3629 [RFC3629] representation of the JWT Header.
Base64url Encoding For the purposes of this specification, this term Base64url Encoding For the purposes of this specification, this term
always refers to the URL- and filename-safe Base64 encoding always refers to the URL- and filename-safe Base64 encoding
described in RFC 4648 [RFC4648], Section 5, with the (non URL- described in RFC 4648 [RFC4648], Section 5, with the (non URL-
safe) '=' padding characters omitted, as permitted by Section 3.2. safe) '=' padding characters omitted, as permitted by Section 3.2.
(See Appendix C of [JWS] for notes on implementing base64url (See Appendix C of [JWS] for notes on implementing base64url
encoding without padding.) encoding without padding.)
StringOrURI A JSON string value, with the additional requirement
that while arbitrary string values MAY be used, any value
containing a ":" character MUST be a URI as defined in RFC 3986
[RFC3986].
IntDate A JSON numeric value representing the number of seconds from
1970-01-01T0:0:0Z UTC until the specified UTC date/time. See RFC
3339 [RFC3339] for details regarding date/times in general and UTC
in particular.
3. JSON Web Token (JWT) Overview 3. JSON Web Token (JWT) Overview
JWTs represent a set of claims as a JSON object that is base64url JWTs represent a set of claims as a JSON object that is base64url
encoded and digitally signed or HMACed and/or encrypted. The JWT encoded and digitally signed or MACed and/or encrypted. The JWT
Claims Set represents this JSON object. As per RFC 4627 [RFC4627] Claims Set represents this JSON object. As per RFC 4627 [RFC4627]
Section 2.2, the JSON object consists of zero or more name/value Section 2.2, the JSON object consists of zero or more name/value
pairs (or members), where the names are strings and the values are pairs (or members), where the names are strings and the values are
arbitrary JSON values. These members are the claims represented by arbitrary JSON values. These members are the claims represented by
the JWT. the JWT.
The member names within the JWT Claims Set are referred to as Claim The member names within the JWT Claims Set are referred to as Claim
Names. The corresponding values are referred to as Claim Values. Names. The corresponding values are referred to as Claim Values.
The bytes of the UTF-8 representation of the JWT Claims Set are The bytes of the UTF-8 representation of the JWT Claims Set are
digitally signed or HMACed in the manner described in JSON Web digitally signed or MACed in the manner described in JSON Web
Signature (JWS) [JWS] and/or encrypted in the manner described in Signature (JWS) [JWS] and/or encrypted in the manner described in
JSON Web Encryption (JWE) [JWE]. JSON Web Encryption (JWE) [JWE].
The contents of the JWT Header describe the cryptographic operations The contents of the JWT Header describe the cryptographic operations
applied to the JWT Claims Set. If the JWT Header is a JWS Header, the applied to the JWT Claims Set. If the JWT Header is a JWS Header, the
claims are digitally signed or HMACed. If the JWT Header is a JWE claims are digitally signed or MACed. If the JWT Header is a JWE
Header, the claims are encrypted. Header, the claims are encrypted.
A JWT is represented as a JWS or JWE. The number of parts is A JWT is represented as a JWS or JWE. The number of parts is
dependent upon the representation of the resulting JWS or JWE. dependent upon the representation of the resulting JWS or JWE.
3.1. Example JWT 3.1. Example JWT
The following example JWT Header declares that the encoded object is The following example JWT Header declares that the encoded object is
a JSON Web Token (JWT) and the JWT is HMACed using the HMAC SHA-256 a JSON Web Token (JWT) and the JWT is MACed using the HMAC SHA-256
algorithm: algorithm:
{"typ":"JWT", {"typ":"JWT",
"alg":"HS256"} "alg":"HS256"}
Base64url encoding the bytes of the UTF-8 representation of the JWT Base64url encoding the bytes of the UTF-8 representation of the JWT
Header yields this Encoded JWS Header value, which is used as the Header yields this Encoded JWS Header value, which is used as the
Encoded JWT Header: Encoded JWT Header:
eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9
The following is an example of a JWT Claims Set: The following is an example of a JWT Claims Set:
{"iss":"joe", {"iss":"joe",
"exp":1300819380, "exp":1300819380,
"http://example.com/is_root":true} "http://example.com/is_root":true}
Base64url encoding the bytes of the UTF-8 representation of the JSON Base64url encoding the bytes of the UTF-8 representation of the JSON
Claims Set yields this Encoded JWS Payload (with line breaks for Claims Set yields this Encoded JWS Payload (with line breaks for
display purposes only): display purposes only):
skipping to change at page 6, line 40 skipping to change at page 6, line 51
. .
dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
This computation is illustrated in more detail in [JWS], Appendix This computation is illustrated in more detail in [JWS], Appendix
A.1. A.1.
4. JWT Claims 4. JWT Claims
The JWT Claims Set represents a JSON object whose members are the The JWT Claims Set represents a JSON object whose members are the
claims conveyed by the JWT. The Claim Names within this object MUST claims conveyed by the JWT. The Claim Names within this object MUST
be unique. Note however, that the set of claims that a JWT must be unique; JWTs with duplicate Claim Names MUST be rejected. Note
contain to be considered valid is context-dependent and is outside however, that the set of claims that a JWT must contain to be
the scope of this specification. When used in a security-related considered valid is context-dependent and is outside the scope of
context, implementations MUST understand and support all of the this specification. When used in a security-related context,
claims present; otherwise, the JWT MUST be rejected for processing. implementations MUST understand and support all of the claims
present; otherwise, the JWT MUST be rejected for processing.
There are three classes of JWT Claim Names: Reserved Claim Names, There are three classes of JWT Claim Names: Reserved Claim Names,
Public Claim Names, and Private Claim Names. Public Claim Names, and Private Claim Names.
4.1. Reserved Claim Names 4.1. Reserved Claim Names
The following claim names are reserved. None of the claims defined The following claim names are reserved. None of the claims defined
in the table below are intended to be mandatory, but rather, provide below are intended to be mandatory, but rather, provide a starting
a starting point for a set of useful, interoperable claims. All the point for a set of useful, interoperable claims. All the names are
names are short because a core goal of JWTs is for the tokens to be short because a core goal of JWTs is for the tokens to be compact.
compact. Additional reserved claim names MAY be defined via the IANA JSON Web
Token Claims registry Section 9.1.
+-------+--------+-------------+------------------------------------+ 4.1.1. "exp" (Expiration Time) Claim
| Claim | JSON | Claim | Claim Semantics |
| Name | Value | Syntax | |
| | Type | | |
+-------+--------+-------------+------------------------------------+
| exp | number | IntDate | The "exp" (expiration time) claim |
| | | | identifies the expiration time on |
| | | | or after which the token MUST NOT |
| | | | be accepted for processing. The |
| | | | processing of the "exp" claim |
| | | | requires that the current |
| | | | date/time MUST be before the |
| | | | expiration date/time listed in the |
| | | | "exp" claim. Implementers MAY |
| | | | provide for some small leeway, |
| | | | usually no more than a few |
| | | | minutes, to account for clock |
| | | | skew. This claim is OPTIONAL. |
| nbf | number | IntDate | The "nbf" (not before) claim |
| | | | identifies the time before which |
| | | | the token MUST NOT be accepted for |
| | | | processing. The processing of the |
| | | | "nbf" claim requires that the |
| | | | current date/time MUST be after or |
| | | | equal to the not-before date/time |
| | | | listed in the "nbf" claim. |
| | | | Implementers MAY provide for some |
| | | | small leeway, usually no more than |
| | | | a few minutes, to account for |
| | | | clock skew. This claim is |
| | | | OPTIONAL. |
| iat | number | IntDate | The "iat" (issued at) claim |
| | | | identifies the time at which the |
| | | | JWT was issued. This claim can be |
| | | | used to determine the age of the |
| | | | token. This claim is OPTIONAL. |
| iss | string | StringOrURI | The "iss" (issuer) claim |
| | | | identifies the principal that |
| | | | issued the JWT. The processing of |
| | | | this claim is generally |
| | | | application specific. The "iss" |
| | | | value is case sensitive. This |
| | | | claim is OPTIONAL. |
| aud | string | StringOrURI | The "aud" (audience) claim |
| | | | identifies the audience that the |
| | | | JWT is intended for. The |
| | | | principal intended to process the |
| | | | JWT MUST be identified with the |
| | | | value of the audience claim. If |
| | | | the principal processing the claim |
| | | | does not identify itself with the |
| | | | identifier in the "aud" claim |
| | | | value then the JWT MUST be |
| | | | rejected. The interpretation of |
| | | | the audience value is generally |
| | | | application specific. The "aud" |
| | | | value is case sensitive. This |
| | | | claim is OPTIONAL. |
| prn | string | StringOrURI | The "prn" (principal) claim |
| | | | identifies the subject of the JWT. |
| | | | The processing of this claim is |
| | | | generally application specific. |
| | | | The "prn" value is case sensitive. |
| | | | This claim is OPTIONAL. |
| jti | string | String | The "jti" (JWT ID) claim provides |
| | | | a unique identifier for the JWT. |
| | | | The identifier value MUST be |
| | | | assigned in a manner that ensures |
| | | | that there is a negligible |
| | | | probability that the same value |
| | | | will be accidentally assigned to a |
| | | | different data object. The "jti" |
| | | | claim can be used to prevent the |
| | | | JWT from being replayed. The |
| | | | "jti" value is case sensitive. |
| | | | This claim is OPTIONAL. |
| typ | string | String | The "typ" (type) claim is used to |
| | | | declare a type for the contents of |
| | | | this JWT Claims Set. The "typ" |
| | | | value is case sensitive. This |
| | | | claim is OPTIONAL. |
+-------+--------+-------------+------------------------------------+
Table 1: Reserved Claim Definitions The "exp" (expiration time) claim identifies the expiration time on
or after which the token MUST NOT be accepted for processing. The
processing of the "exp" claim requires that the current date/time
MUST be before the expiration date/time listed in the "exp" claim.
Implementers MAY provide for some small leeway, usually no more than
a few minutes, to account for clock skew. Its value MUST be a number
containing an IntDate value. This claim is OPTIONAL.
Additional reserved claim names MAY be defined via the IANA JSON Web 4.1.2. "nbf" (Not Before) Claim
Token Claims Registry Section 9.1. The syntax values used above are
defined as follows:
+-------------+-----------------------------------------------------+ The "nbf" (not before) claim identifies the time before which the
| Syntax Name | Syntax Definition | token MUST NOT be accepted for processing. The processing of the
+-------------+-----------------------------------------------------+ "nbf" claim requires that the current date/time MUST be after or
| IntDate | The number of seconds from 1970-01-01T0:0:0Z as | equal to the not-before date/time listed in the "nbf" claim.
| | measured in UTC until the desired date/time. See | Implementers MAY provide for some small leeway, usually no more than
| | RFC 3339 [RFC3339] for details regarding date/times | a few minutes, to account for clock skew. Its value MUST be a number
| | in general and UTC in particular. | containing an IntDate value. This claim is OPTIONAL.
| String | Any string value MAY be used. |
| StringOrURI | Any string value MAY be used but a value containing |
| | a ":" character MUST be a URI as defined in RFC |
| | 3986 [RFC3986]. |
+-------------+-----------------------------------------------------+
Table 2: Claim Syntax Definitions 4.1.3. "iat" (Issued At) Claim
The "iat" (issued at) claim identifies the time at which the JWT was
issued. This claim can be used to determine the age of the token.
Its value MUST be a number containing an IntDate value. This claim
is OPTIONAL.
4.1.4. "iss" (Issuer) Claim
The "iss" (issuer) claim identifies the principal that issued the
JWT. The processing of this claim is generally application specific.
The "iss" value is case sensitive. Its value MUST be a string
containing a StringOrURI value. This claim is OPTIONAL.
4.1.5. "aud" (Audience) Claim
The "aud" (audience) claim identifies the audience that the JWT is
intended for. The principal intended to process the JWT MUST be
identified with the value of the audience claim. If the principal
processing the claim does not identify itself with the identifier in
the "aud" claim value then the JWT MUST be rejected. The
interpretation of the audience value is generally application
specific. The "aud" value is case sensitive. Its value MUST be a
string containing a StringOrURI value. This claim is OPTIONAL.
4.1.6. "prn" (Principal) Claim
The "prn" (principal) claim identifies the subject of the JWT. The
processing of this claim is generally application specific. The
"prn" value is case sensitive. Its value MUST be a string containing
a StringOrURI value. This claim is OPTIONAL.
4.1.7. "jti" (JWT ID) Claim
The "jti" (JWT ID) claim provides a unique identifier for the JWT.
The identifier value MUST be assigned in a manner that ensures that
there is a negligible probability that the same value will be
accidentally assigned to a different data object. The "jti" claim
can be used to prevent the JWT from being replayed. The "jti" value
is case sensitive. Its value MUST be a string. This claim is
OPTIONAL.
4.1.8. "typ" (Type) Claim
The "typ" (type) claim is used to declare a type for the contents of
this JWT Claims Set. The "typ" value is case sensitive. Its value
MUST be a string. This claim is OPTIONAL.
The values used for the "typ" claim SHOULD come from the same value
space as the "typ" header parameter, with the same rules applying.
4.2. Public Claim Names 4.2. Public Claim Names
Claim names can be defined at will by those using JWTs. However, in Claim names can be defined at will by those using JWTs. However, in
order to prevent collisions, any new claim name SHOULD either be order to prevent collisions, any new claim name SHOULD either be
defined in the IANA JSON Web Token Claims Registry Section 9.1 or be defined in the IANA JSON Web Token Claims registry Section 9.1 or be
defined as a URI that contains a collision resistant namespace. a URI that contains a collision resistant namespace. Examples of
Examples of collision resistant namespaces include: collision resistant namespaces include:
o Domain Names, o Domain Names,
o Object Identifiers (OIDs) as defined in the ITU-T X.660 and X.670 o Object Identifiers (OIDs) as defined in the ITU-T X.660 and X.670
Recommendation series, or Recommendation series, or
o Universally Unique IDentifier (UUID) as defined in RFC 4122 o Universally Unique IDentifier (UUID) as defined in RFC 4122
[RFC4122]. [RFC4122].
In each case, the definer of the name or value needs to take In each case, the definer of the name or value needs to take
skipping to change at page 10, line 11 skipping to change at page 9, line 33
not a Reserved Name Section 4.1 or a Public Name Section 4.2. Unlike not a Reserved Name Section 4.1 or a Public Name Section 4.2. Unlike
Public Names, these private names are subject to collision and should Public Names, these private names are subject to collision and should
be used with caution. be used with caution.
5. JWT Header 5. JWT Header
The members of the JSON object represented by the JWT Header describe The members of the JSON object represented by the JWT Header describe
the cryptographic operations applied to the JWT and optionally, the cryptographic operations applied to the JWT and optionally,
additional properties of the JWT. The member names within the JWT additional properties of the JWT. The member names within the JWT
Header are referred to as Header Parameter Names. These names MUST Header are referred to as Header Parameter Names. These names MUST
be unique. The corresponding values are referred to as Header be unique; JWTs with duplicate Header Parameter Names MUST be
rejected. The corresponding values are referred to as Header
Parameter Values. Parameter Values.
Implementations MUST understand the entire contents of the header; Implementations MUST understand the entire contents of the header;
otherwise, the JWT MUST be rejected for processing. otherwise, the JWT MUST be rejected for processing.
There are two ways of distinguishing whether the JWT is a JWS or JWE. There are two ways of distinguishing whether the JWT is a JWS or JWE.
The first is by examining the "alg" (algorithm) header value. If the The first is by examining the "alg" (algorithm) header value. If the
value represents a signature algorithm, the JWT is a JWS; if it value represents a signature algorithm, the JWT is a JWS; if it
represents an encryption algorithm, the JWT is a JWE. A second represents an encryption algorithm, the JWT is a JWE. A second
method is determining whether an "enc" (encryption method) member method is determining whether an "enc" (encryption method) member
exists. If the "enc" member exists, the JWT is a JWE; otherwise, the exists. If the "enc" member exists, the JWT is a JWE; otherwise, the
JWT is a JWS. Both methods will yield the same result. JWT is a JWS. Both methods will yield the same result.
JWS Header Parameters are defined by [JWS]. JWE Header Parameters JWS Header Parameters are defined by [JWS]. JWE Header Parameters
are defined by [JWE]. This specification further specifies the use are defined by [JWE]. This specification further specifies the use
of the following header parameters in both the cases where the JWT is of the following header parameters in both the cases where the JWT is
a JWS and where it is a JWE. a JWS and where it is a JWE.
+----------+-------+----------+-------------------------------------+ 5.1. "typ" (Type) Header Parameter
| Header | JSON | Header | Header Parameter Semantics |
| Paramete | Value | Paramete | |
| rName | Type | rSyntax | |
+----------+-------+----------+-------------------------------------+
| typ | strin | String | The "typ" (type) header parameter |
| | g | | is used to declare structural |
| | | | information about the JWT. In the |
| | | | normal case where nested signing or |
| | | | encryption operations are not |
| | | | employed, the use of this header |
| | | | parameter is OPTIONAL, and if |
| | | | present, it is RECOMMENDED that its |
| | | | value be either "JWT" or |
| | | | "urn:ietf:params:oauth:token-type:j |
| | | | wt". In the case that nested |
| | | | signing or encryption steps are |
| | | | employed, the use of this header |
| | | | parameter is REQUIRED; in this |
| | | | case, the value MUST either be |
| | | | "JWS", to indicate that a nested |
| | | | digitally signed or HMACed JWT is |
| | | | carried in this JWT or "JWE", to |
| | | | indicate that a nested encrypted |
| | | | JWT is carried in this JWT. |
+----------+-------+----------+-------------------------------------+
Table 3: Reserved Header Parameter Usage The "typ" (type) header parameter is used to declare structural
information about the JWT. In the normal case where nested signing
or encryption operations are not employed, the use of this header
parameter is OPTIONAL, and if present, it is RECOMMENDED that its
value be either "JWT" or "urn:ietf:params:oauth:token-type:jwt". In
the case that nested signing or encryption steps are employed, the
use of this header parameter is REQUIRED; in this case, the value
MUST either be "JWS", to indicate that a nested digitally signed or
MACed JWT is carried in this JWT or "JWE", to indicate that a nested
encrypted JWT is carried in this JWT.
6. Plaintext JWTs 6. Plaintext JWTs
To support use cases where the JWT content is secured by a means To support use cases where the JWT content is secured by a means
other than a signature and/or encryption contained within the token other than a signature and/or encryption contained within the token
(such as a signature on a data structure containing the token), JWTs (such as a signature on a data structure containing the token), JWTs
MAY also be created without a signature or encryption. A plaintext MAY also be created without a signature or encryption. A plaintext
JWT is a JWS using the "none" JWS "alg" header parameter value JWT is a JWS using the "none" JWS "alg" header parameter value
defined in JSON Web Algorithms (JWA) [JWA]; it is a JWS with an empty defined in JSON Web Algorithms (JWA) [JWA]; it is a JWS with an empty
JWS Signature value. JWS Signature value.
skipping to change at page 13, line 38 skipping to change at page 12, line 22
1. The JWT MUST contain at least one period character. 1. The JWT MUST contain at least one period character.
2. Let the Encoded JWT Header be the portion of the JWT before the 2. Let the Encoded JWT Header be the portion of the JWT before the
first period character. first period character.
3. The Encoded JWT Header MUST be successfully base64url decoded 3. The Encoded JWT Header MUST be successfully base64url decoded
following the restriction given in this specification that no following the restriction given in this specification that no
padding characters have been used. padding characters have been used.
4. The JWT Header MUST be completely valid JSON syntax conforming 4. The resulting JWT Header MUST be completely valid JSON syntax
to RFC 4627 [RFC4627]. conforming to RFC 4627 [RFC4627].
5. The JWT Header MUST be validated to only include parameters and 5. The resulting JWT Header MUST be validated to only include
values whose syntax and semantics are both understood and parameters and values whose syntax and semantics are both
supported. understood and supported.
6. Determine whether the JWT is a JWS or a JWE by examining the 6. Determine whether the JWT is a JWS or a JWE by examining the
"alg" (algorithm) header value and optionally, the "enc" "alg" (algorithm) header value and optionally, the "enc"
(encryption method) header value, if present. (encryption method) header value, if present.
7. Depending upon whether the JWT is a JWS or JWE, there are two 7. Depending upon whether the JWT is a JWS or JWE, there are two
cases: cases:
* If the JWT is a JWS, all steps specified in [JWS] for * If the JWT is a JWS, all steps specified in [JWS] for
validating a JWS MUST be followed. Let the Message be the validating a JWS MUST be followed. Let the Message be the
skipping to change at page 15, line 13 skipping to change at page 13, line 42
[JWE] to sign and/or encrypt the contents of the JWT. [JWE] to sign and/or encrypt the contents of the JWT.
Of the JWS signing algorithms, only HMAC SHA-256 and "none" MUST be Of the JWS signing algorithms, only HMAC SHA-256 and "none" MUST be
implemented by conforming JWT implementations. It is RECOMMENDED implemented by conforming JWT implementations. It is RECOMMENDED
that implementations also support the RSA SHA-256 and ECDSA P-256 that implementations also support the RSA SHA-256 and ECDSA P-256
SHA-256 algorithms. Support for other algorithms and key sizes is SHA-256 algorithms. Support for other algorithms and key sizes is
OPTIONAL. OPTIONAL.
If an implementation provides encryption capabilities, of the JWE If an implementation provides encryption capabilities, of the JWE
encryption algorithms, only RSA-PKCS1-1.5 with 2048 bit keys, AES- encryption algorithms, only RSA-PKCS1-1.5 with 2048 bit keys, AES-
128-CBC, and AES-256-CBC MUST be implemented by conforming 128-KW, AES-256-KW, AES-128-CBC, and AES-256-CBC MUST be implemented
implementations. It is RECOMMENDED that implementations also support by conforming implementations. It is RECOMMENDED that
ECDH-ES with 256 bit keys, AES-128-GCM, and AES-256-GCM. Support for implementations also support ECDH-ES with 256 bit keys, AES-128-GCM,
other algorithms and key sizes is OPTIONAL. and AES-256-GCM. Support for other algorithms and key sizes is
OPTIONAL.
9. IANA Considerations 9. IANA Considerations
9.1. JSON Web Token Claims Registry 9.1. JSON Web Token Claims Registry
The IANA registry entitled "JSON Web Token Claims" for reserved JWT This specification establishes the IANA JSON Web Token Claims
claim names is defined in Section 4.1. Inclusion in the registry is registry for reserved JWT claim names. Inclusion in the registry is
RFC Required in the RFC 5226 [RFC5226] sense for reserved JWT claim RFC Required in the RFC 5226 [RFC5226] sense. The registry records
names that are intended to be interoperable between implementations. the reserved claim name and a reference to the RFC that defines it.
The registry will just record the reserved claim name and a pointer This specification registers the claim names defined in Section 4.1.
to the RFC that defines it. This specification defines inclusion of
the claim names defined in Section 4.1.
9.2. Sub-Namespace Registration of urn:ietf:params:oauth:token-type:jwt 9.2. Sub-Namespace Registration of urn:ietf:params:oauth:token-type:jwt
This is a request to IANA to register the value "token-type:jwt" in This specification registers the value "token-type:jwt" in the
the registry urn:ietf:params:oauth established in An IETF URN Sub- registry urn:ietf:params:oauth established in An IETF URN Sub-
Namespace for OAuth [I-D.ietf-oauth-urn-sub-ns]. Namespace for OAuth [I-D.ietf-oauth-urn-sub-ns].
o URN: urn:ietf:params:oauth:token-type:jwt o URN: urn:ietf:params:oauth:token-type:jwt
o Common Name: JSON Web Token (JWT) Token Type o Common Name: JSON Web Token (JWT) Token Type
o Change controller: IETF o Change controller: IETF
o Description: [[this document]] o Description: [[this document]]
9.3. Registration of application/jwt MIME Media Type 9.3. Registration of application/jwt MIME Media Type
This specification registers the "application/jwt" MIME Media Type. This specification registers the "application/jwt" MIME Media Type
RFC 2045 [RFC2045].
Type name: Type name:
application application
Subtype name: Subtype name:
jwt jwt
Required parameters: Required parameters:
n/a n/a
skipping to change at page 17, line 5 skipping to change at page 15, line 38
none none
Author: Author:
Michael B. Jones Michael B. Jones
mbj@microsoft.com mbj@microsoft.com
Change controller: Change controller:
Michael B. Jones Michael B. Jones
mbj@microsoft.com mbj@microsoft.com
10. Security Considerations 9.4. Registration of "JWT" Type Value
TBD: Lots of work to do here. We need to remember to look into any This specification registers the following "typ" header parameter
issues relating to security and JSON parsing. One wonders just how value in the JSON Web Signature and Encryption "typ" Values registry
secure most JSON parsing libraries are. Were they ever hardened for established by the JSON Web Algorithms (JWA) [JWA] specification:
security scenarios? If not, what kind of holes does that open up?
Also, we need to walk through the JSON standard and see what kind of
issues we have especially around comparison of names. For instance,
comparisons of claim names and other parameters must occur after they
are unescaped. Need to also put in text about: Importance of keeping
secrets secret. Rotating keys. Strengths and weaknesses of the
different algorithms.
TBD: Need to put in text about why strict JSON validation is "typ" header parameter value:
necessary. Basically, that if malformed JSON is received then the "JWT"
intent of the sender is impossible to reliably discern. One example
of malformed JSON that MUST be rejected is an object in which the
same member name occurs multiple times. While in non-security
contexts it's o.k. to be generous in what one accepts, in security
contexts this can lead to serious security holes. For example,
malformed JSON might indicate that someone has managed to find a
security hole in the issuer's code and is leveraging it to get the
issuer to issue "bad" tokens whose content the attacker can control.
TBD: Write about the need to secure the token content if a signature Abbreviation for MIME type:
is not contained in the JWT itself. application/jwt
10.1. Unicode Comparison Security Issues Change controller:
Michael B. Jones
mbj@microsoft.com
Claim names in JWTs are Unicode strings. For security reasons, the Description:
representations of these names must be compared verbatim after [[ this document ]]
performing any escape processing (as per RFC 4627 [RFC4627], Section
2.5).
This means, for instance, that these JSON strings must compare as 10. Security Considerations
being equal ("JWT", "\u004aWT"), whereas these must all compare as
being not equal to the first set or to each other ("jwt", "Jwt",
"JW\u0074").
JSON strings MAY contain characters outside the Unicode Basic All the security considerations in the JWS specification also apply
Multilingual Plane. For instance, the G clef character (U+1D11E) may to JWT, as do the JWE security considerations when encryption is
be represented in a JSON string as "\uD834\uDD1E". Ideally, JWT employed. In particular, the JWS JSON Security Considerations and
implementations SHOULD ensure that characters outside the Basic Unicode Comparison Security Considerations apply equally to the JWT
Multilingual Plane are preserved and compared correctly; Claims Set in the same manner that they do to the JWS Header.
alternatively, if this is not possible due to these characters
exercising limitations present in the underlying JSON implementation,
then input containing them MUST be rejected.
11. Open Issues and Things To Be Done (TBD) 11. Open Issues and Things To Be Done (TBD)
The following items remain to be done in this draft: The following items remain to be done in this draft:
o EDITORIAL: Give each claim name and header parameter definition
its own section. This will let them appear in the index, will
give space for examples when needed, and will get rid of the way-
too-cramped tables.
o Add normative text that requires rejecting headers and Claim Sets
in which member names occur multiple times, as apparently this is
legal JSON.
o Provide an example of an encrypted JWT. o Provide an example of an encrypted JWT.
o Clarify the intended use of the "typ" Header Parameter across the
JWS, JWE, and JWT specifications. Decide whether a registry of
"typ" values is appropriate.
o EDITORIAL: Think about how to best describe the concept currently
described as "the bytes of the UTF-8 representation of". Possible
terms to use instead of "bytes of" include "byte sequence", "octet
series", and "octet sequence". Also consider whether we want to
add an overall clarifying statement somewhere in each spec
something like "every place we say 'the UTF-8 representation of
X', we mean 'the bytes of the UTF-8 representation of X'". That
would potentially allow us to omit the "the bytes of" part
everywhere else.
o Finish the Security Considerations section.
o Possibly write a companion specification that uses the JWS and JWE
JSON Serializations.
12. References 12. References
12.1. Normative References 12.1. Normative References
[I-D.ietf-oauth-urn-sub-ns] [I-D.ietf-oauth-urn-sub-ns]
Tschofenig, H., "An IETF URN Sub-Namespace for OAuth", Tschofenig, H., "An IETF URN Sub-Namespace for OAuth",
draft-ietf-oauth-urn-sub-ns-02 (work in progress), draft-ietf-oauth-urn-sub-ns-02 (work in progress),
January 2012. January 2012.
[JWA] Jones, M., "JSON Web Algorithms (JWA)", March 2012. [JWA] Jones, M., "JSON Web Algorithms (JWA)", May 2012.
[JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web [JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web
Encryption (JWE)", March 2012. Encryption (JWE)", May 2012.
[JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
Signature (JWS)", March 2012. Signature (JWS)", May 2012.
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message
Bodies", RFC 2045, November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the
Internet: Timestamps", RFC 3339, July 2002. Internet: Timestamps", RFC 3339, July 2002.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, November 2003. 10646", STD 63, RFC 3629, November 2003.
skipping to change at page 20, line 31 skipping to change at page 18, line 25
tokens with much greater expressivity and more security options than tokens with much greater expressivity and more security options than
supported by JWTs. However, the cost of this flexibility and supported by JWTs. However, the cost of this flexibility and
expressiveness is both size and complexity. In addition, SAML's use expressiveness is both size and complexity. In addition, SAML's use
of XML [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] only of XML [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] only
contributes to the size of SAML tokens. contributes to the size of SAML tokens.
JWTs are intended to provide a simple token format that is small JWTs are intended to provide a simple token format that is small
enough to fit into HTTP headers and query arguments in URIs. It does enough to fit into HTTP headers and query arguments in URIs. It does
this by supporting a much simpler token model than SAML and using the this by supporting a much simpler token model than SAML and using the
JSON [RFC4627] object encoding syntax. It also supports securing JSON [RFC4627] object encoding syntax. It also supports securing
tokens using Hash-based Message Authentication Codes (HMACs) and tokens using Message Authentication Codes (MACs) and digital
digital signatures using a smaller (and less flexible) format than signatures using a smaller (and less flexible) format than XML DSIG.
XML DSIG.
Therefore, while JWTs can do some of the things SAML tokens do, JWTs Therefore, while JWTs can do some of the things SAML tokens do, JWTs
are not intended as a full replacement for SAML tokens, but rather as are not intended as a full replacement for SAML tokens, but rather as
a compromise token format to be used when space is at a premium. a compromise token format to be used when space is at a premium.
Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs) Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs)
Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets
of claims to be communicated between applications. For SWTs, both of claims to be communicated between applications. For SWTs, both
the claim names and claim values are strings. For JWTs, while claim the claim names and claim values are strings. For JWTs, while claim
skipping to change at page 21, line 18 skipping to change at page 19, line 9
influenced by the design and simplicity of Simple Web Tokens [SWT] influenced by the design and simplicity of Simple Web Tokens [SWT]
and ideas for JSON tokens that Dick Hardt discussed within the OpenID and ideas for JSON tokens that Dick Hardt discussed within the OpenID
community. community.
Solutions for signing JSON content were previously explored by Magic Solutions for signing JSON content were previously explored by Magic
Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas
Applications [CanvasApp], all of which influenced this draft. Applications [CanvasApp], all of which influenced this draft.
Appendix D. Document History Appendix D. Document History
-10
o Clarified the relationship between "typ" header parameter values,
"typ" claim values, and MIME types.
o Clarified that JWTs with duplicate Header Parameter Names or
Duplicate Claim names MUST be rejected.
o Required implementation of AES-128-KW and AES-256-KW when the
implementation provides encryption capabilities.
o Registered "JWT" typ header parameter value.
o Generalized language to refer to Message Authentication Codes
(MACs) rather than Hash-based Message Authentication Codes (HMACs)
unless in a context specific to HMAC algorithms.
o Reformatted to give each claim definition and header parameter its
own section heading.
-09 -09
o Changed "http://openid.net/specs/jwt/1.0" to o Changed "http://openid.net/specs/jwt/1.0" to
"urn:ietf:params:oauth:token-type:jwt" in preparation for OAuth WG "urn:ietf:params:oauth:token-type:jwt" in preparation for OAuth WG
draft. draft.
-08 -08
o Removed language that required that a JWT must have three parts. o Removed language that required that a JWT must have three parts.
Now the number of parts is explicitly dependent upon the Now the number of parts is explicitly dependent upon the
skipping to change at page 23, line 34 skipping to change at page 22, line 4
JSON token convergence proposal incorporating input from several JSON token convergence proposal incorporating input from several
implementers of related specifications. implementers of related specifications.
Authors' Addresses Authors' Addresses
Michael B. Jones Michael B. Jones
Microsoft Microsoft
Email: mbj@microsoft.com Email: mbj@microsoft.com
URI: http://self-issued.info/ URI: http://self-issued.info/
Dirk Balfanz Dirk Balfanz
Google Google
Email: balfanz@google.com Email: balfanz@google.com
John Bradley John Bradley
independent Ping Identity
Email: ve7jtb@ve7jtb.com Email: ve7jtb@ve7jtb.com
Yaron Y. Goland Yaron Y. Goland
Microsoft Microsoft
Email: yarong@microsoft.com Email: yarong@microsoft.com
John Panzer John Panzer
Google Google
Email: jpanzer@google.com Email: jpanzer@google.com
 End of changes. 56 change blocks. 
275 lines changed or deleted 220 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/