idnits 2.17.1 draft-ietf-oauth-json-web-token-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The document date (July 6, 2012) is 4305 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-06) exists of draft-ietf-oauth-urn-sub-ns-05 ** Downref: Normative reference to an Informational draft: draft-ietf-oauth-urn-sub-ns (ref. 'I-D.ietf-oauth-urn-sub-ns') -- Possible downref: Non-RFC (?) normative reference: ref. 'JWA' -- Possible downref: Non-RFC (?) normative reference: ref. 'JWE' -- Possible downref: Non-RFC (?) normative reference: ref. 'JWS' ** Obsolete normative reference: RFC 4288 (Obsoleted by RFC 6838) ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) -- Possible downref: Non-RFC (?) normative reference: ref. 'USA15' Summary: 4 errors (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 OAuth Working Group M. Jones 3 Internet-Draft Microsoft 4 Intended status: Standards Track J. Bradley 5 Expires: January 7, 2013 Ping Identity 6 N. Sakimura 7 NRI 8 July 6, 2012 10 JSON Web Token (JWT) 11 draft-ietf-oauth-json-web-token-01 13 Abstract 15 JSON Web Token (JWT) is a means of representing claims to be 16 transferred between two parties. The claims in a JWT are encoded as 17 a JavaScript Object Notation (JSON) object that is digitally signed 18 or MACed using JSON Web Signature (JWS) and/or encrypted using JSON 19 Web Encryption (JWE). 21 The suggested pronunciation of JWT is the same as the English word 22 "jot". 24 Status of this Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on January 7, 2013. 41 Copyright Notice 43 Copyright (c) 2012 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 59 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 60 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 61 3. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . 5 62 3.1. Example JWT . . . . . . . . . . . . . . . . . . . . . . . 6 63 4. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . . 7 64 4.1. Reserved Claim Names . . . . . . . . . . . . . . . . . . . 7 65 4.1.1. "exp" (Expiration Time) Claim . . . . . . . . . . . . 7 66 4.1.2. "nbf" (Not Before) Claim . . . . . . . . . . . . . . . 7 67 4.1.3. "iat" (Issued At) Claim . . . . . . . . . . . . . . . 8 68 4.1.4. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . . 8 69 4.1.5. "aud" (Audience) Claim . . . . . . . . . . . . . . . . 8 70 4.1.6. "prn" (Principal) Claim . . . . . . . . . . . . . . . 8 71 4.1.7. "jti" (JWT ID) Claim . . . . . . . . . . . . . . . . . 8 72 4.1.8. "typ" (Type) Claim . . . . . . . . . . . . . . . . . . 9 73 4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 9 74 4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 9 75 5. JWT Header . . . . . . . . . . . . . . . . . . . . . . . . . . 9 76 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 9 77 5.2. "cty" (Content Type) Header Parameter . . . . . . . . . . 10 78 6. Plaintext JWTs . . . . . . . . . . . . . . . . . . . . . . . . 10 79 6.1. Example Plaintext JWT . . . . . . . . . . . . . . . . . . 10 80 7. Rules for Creating and Validating a JWT . . . . . . . . . . . 11 81 8. Cryptographic Algorithms . . . . . . . . . . . . . . . . . . . 13 82 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 83 9.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 14 84 9.1.1. Registration Template . . . . . . . . . . . . . . . . 14 85 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 15 86 9.2. Sub-Namespace Registration of 87 urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 16 88 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 16 89 9.3. JSON Web Signature and Encryption Type Values 90 Registration . . . . . . . . . . . . . . . . . . . . . . . 16 91 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 16 92 9.4. Media Type Registration . . . . . . . . . . . . . . . . . 16 93 9.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 16 94 10. Security Considerations . . . . . . . . . . . . . . . . . . . 17 95 11. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 18 96 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18 97 12.1. Normative References . . . . . . . . . . . . . . . . . . . 18 98 12.2. Informative References . . . . . . . . . . . . . . . . . . 19 99 Appendix A. Relationship of JWTs to SAML Tokens . . . . . . . . . 19 100 Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs) . . 20 101 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 20 102 Appendix D. Document History . . . . . . . . . . . . . . . . . . 20 103 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 21 105 1. Introduction 107 JSON Web Token (JWT) is a compact token format intended for space 108 constrained environments such as HTTP Authorization headers and URI 109 query parameters. JWTs encode claims to be transmitted as a 110 JavaScript Object Notation (JSON) [RFC4627] object that is base64url 111 encoded and digitally signed or MACed and/or encrypted. Signing and 112 MACing is performed using JSON Web Signature (JWS) [JWS]. Encryption 113 is performed using JSON Web Encryption (JWE) [JWE]. 115 The suggested pronunciation of JWT is the same as the English word 116 "jot". 118 1.1. Notational Conventions 120 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 121 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 122 document are to be interpreted as described in Key words for use in 123 RFCs to Indicate Requirement Levels [RFC2119]. 125 2. Terminology 127 JSON Web Token (JWT) A string consisting of multiple parts, the 128 first being the Encoded JWT Header, plus additional parts 129 depending upon the contents of the header, with the parts being 130 separated by period ('.') characters, and each part containing 131 base64url encoded content. 133 JWT Header A string representing a JSON object that describes the 134 cryptographic operations applied to the JWT. When the JWT is 135 digitally signed or MACed, the JWT Header is a JWS Header. When 136 the JWT is encrypted, the JWT Header is a JWE Header. 138 Header Parameter Name The name of a member of the JSON object 139 representing a JWT Header. 141 Header Parameter Value The value of a member of the JSON object 142 representing a JWT Header. 144 JWT Claims Set A string representing a JSON object that contains the 145 claims conveyed by the JWT. When the JWT is digitally signed or 146 MACed, the bytes of the UTF-8 representation of the JWT Claims Set 147 are base64url encoded to create the Encoded JWS Payload. When the 148 JWT is encrypted, the bytes of the UTF-8 representation of the JWT 149 Claims Set are used as the JWE Plaintext. 151 Claim Name The name of a member of the JSON object representing a 152 JWT Claims Set. 154 Claim Value The value of a member of the JSON object representing a 155 JWT Claims Set. 157 Encoded JWT Header Base64url encoding of the bytes of the UTF-8 158 [RFC3629] representation of the JWT Header. 160 Base64url Encoding For the purposes of this specification, this term 161 always refers to the URL- and filename-safe Base64 encoding 162 described in RFC 4648 [RFC4648], Section 5, with the (non URL- 163 safe) '=' padding characters omitted, as permitted by Section 3.2. 164 (See Appendix C of [JWS] for notes on implementing base64url 165 encoding without padding.) 167 Collision Resistant Namespace A namespace that allows names to be 168 allocated in a manner such that they are highly unlikely to 169 collide with other names. For instance, collision resistance can 170 be achieved through administrative delegation of portions of the 171 namespace or through use of collision-resistant name allocation 172 functions. Examples of Collision Resistant Namespaces include: 173 Domain Names, Object Identifiers (OIDs) as defined in the ITU-T 174 X.660 and X.670 Recommendation series, and Universally Unique 175 IDentifiers (UUIDs) [RFC4122]. When using an administratively 176 delegated namespace, the definer of a name needs to take 177 reasonable precautions to ensure they are in control of the 178 portion of the namespace they use to define the name. 180 StringOrURI A JSON string value, with the additional requirement 181 that while arbitrary string values MAY be used, any value 182 containing a ":" character MUST be a URI [RFC3986]. 184 IntDate A JSON numeric value representing the number of seconds from 185 1970-01-01T0:0:0Z UTC until the specified UTC date/time. See RFC 186 3339 [RFC3339] for details regarding date/times in general and UTC 187 in particular. 189 3. JSON Web Token (JWT) Overview 191 JWTs represent a set of claims as a JSON object that is base64url 192 encoded and digitally signed or MACed and/or encrypted. The JWT 193 Claims Set represents this JSON object. As per RFC 4627 [RFC4627] 194 Section 2.2, the JSON object consists of zero or more name/value 195 pairs (or members), where the names are strings and the values are 196 arbitrary JSON values. These members are the claims represented by 197 the JWT. 199 The member names within the JWT Claims Set are referred to as Claim 200 Names. The corresponding values are referred to as Claim Values. 202 The bytes of the UTF-8 representation of the JWT Claims Set are 203 digitally signed or MACed in the manner described in JSON Web 204 Signature (JWS) [JWS] and/or encrypted in the manner described in 205 JSON Web Encryption (JWE) [JWE]. 207 The contents of the JWT Header describe the cryptographic operations 208 applied to the JWT Claims Set. If the JWT Header is a JWS Header, the 209 claims are digitally signed or MACed. If the JWT Header is a JWE 210 Header, the claims are encrypted. 212 A JWT is represented as a JWS or JWE. The number of parts is 213 dependent upon the representation of the resulting JWS or JWE. 215 3.1. Example JWT 217 The following example JWT Header declares that the encoded object is 218 a JSON Web Token (JWT) and the JWT is MACed using the HMAC SHA-256 219 algorithm: 220 {"typ":"JWT", 221 "alg":"HS256"} 223 Base64url encoding the bytes of the UTF-8 representation of the JWT 224 Header yields this Encoded JWS Header value, which is used as the 225 Encoded JWT Header: 226 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 228 The following is an example of a JWT Claims Set: 229 {"iss":"joe", 230 "exp":1300819380, 231 "http://example.com/is_root":true} 233 Base64url encoding the bytes of the UTF-8 representation of the JSON 234 Claims Set yields this Encoded JWS Payload (with line breaks for 235 display purposes only): 236 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly 237 9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ 239 Signing the Encoded JWS Header and Encoded JWS Payload with the HMAC 240 SHA-256 algorithm and base64url encoding the signature in the manner 241 specified in [JWS], yields this Encoded JWS Signature: 242 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 244 Concatenating these parts in this order with period characters 245 between the parts yields this complete JWT (with line breaks for 246 display purposes only): 248 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 249 . 250 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 251 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 252 . 253 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 255 This computation is illustrated in more detail in [JWS], Appendix 256 A.1. 258 4. JWT Claims 260 The JWT Claims Set represents a JSON object whose members are the 261 claims conveyed by the JWT. The Claim Names within this object MUST 262 be unique; JWTs with duplicate Claim Names MUST be rejected. Note 263 however, that the set of claims that a JWT must contain to be 264 considered valid is context-dependent and is outside the scope of 265 this specification. When used in a security-related context, 266 implementations MUST understand and support all of the claims 267 present; otherwise, the JWT MUST be rejected for processing. 269 There are three classes of JWT Claim Names: Reserved Claim Names, 270 Public Claim Names, and Private Claim Names. 272 4.1. Reserved Claim Names 274 The following claim names are reserved. None of the claims defined 275 below are intended to be mandatory, but rather, provide a starting 276 point for a set of useful, interoperable claims. All the names are 277 short because a core goal of JWTs is for the tokens to be compact. 278 Additional reserved claim names MAY be defined via the IANA JSON Web 279 Token Claims registry Section 9.1. 281 4.1.1. "exp" (Expiration Time) Claim 283 The "exp" (expiration time) claim identifies the expiration time on 284 or after which the token MUST NOT be accepted for processing. The 285 processing of the "exp" claim requires that the current date/time 286 MUST be before the expiration date/time listed in the "exp" claim. 287 Implementers MAY provide for some small leeway, usually no more than 288 a few minutes, to account for clock skew. Its value MUST be a number 289 containing an IntDate value. This claim is OPTIONAL. 291 4.1.2. "nbf" (Not Before) Claim 293 The "nbf" (not before) claim identifies the time before which the 294 token MUST NOT be accepted for processing. The processing of the 295 "nbf" claim requires that the current date/time MUST be after or 296 equal to the not-before date/time listed in the "nbf" claim. 297 Implementers MAY provide for some small leeway, usually no more than 298 a few minutes, to account for clock skew. Its value MUST be a number 299 containing an IntDate value. This claim is OPTIONAL. 301 4.1.3. "iat" (Issued At) Claim 303 The "iat" (issued at) claim identifies the time at which the JWT was 304 issued. This claim can be used to determine the age of the token. 305 Its value MUST be a number containing an IntDate value. This claim 306 is OPTIONAL. 308 4.1.4. "iss" (Issuer) Claim 310 The "iss" (issuer) claim identifies the principal that issued the 311 JWT. The processing of this claim is generally application specific. 312 The "iss" value is case sensitive. Its value MUST be a string 313 containing a StringOrURI value. This claim is OPTIONAL. 315 4.1.5. "aud" (Audience) Claim 317 The "aud" (audience) claim identifies the audience that the JWT is 318 intended for. The principal intended to process the JWT MUST be 319 identified with the value of the audience claim. If the principal 320 processing the claim does not identify itself with the identifier in 321 the "aud" claim value then the JWT MUST be rejected. The 322 interpretation of the audience value is generally application 323 specific. The "aud" value is case sensitive. Its value MUST be a 324 string containing a StringOrURI value. This claim is OPTIONAL. 326 4.1.6. "prn" (Principal) Claim 328 The "prn" (principal) claim identifies the subject of the JWT. The 329 processing of this claim is generally application specific. The 330 "prn" value is case sensitive. Its value MUST be a string containing 331 a StringOrURI value. This claim is OPTIONAL. 333 4.1.7. "jti" (JWT ID) Claim 335 The "jti" (JWT ID) claim provides a unique identifier for the JWT. 336 The identifier value MUST be assigned in a manner that ensures that 337 there is a negligible probability that the same value will be 338 accidentally assigned to a different data object. The "jti" claim 339 can be used to prevent the JWT from being replayed. The "jti" value 340 is case sensitive. Its value MUST be a string. This claim is 341 OPTIONAL. 343 4.1.8. "typ" (Type) Claim 345 The "typ" (type) claim is used to declare a type for the contents of 346 this JWT Claims Set. The "typ" value is case sensitive. Its value 347 MUST be a string. This claim is OPTIONAL. 349 The values used for the "typ" claim come from the same value space as 350 the "typ" header parameter, with the same rules applying. 352 4.2. Public Claim Names 354 Claim names can be defined at will by those using JWTs. However, in 355 order to prevent collisions, any new claim name SHOULD either be 356 registered in the IANA JSON Web Token Claims registry Section 9.1 or 357 be a URI that contains a Collision Resistant Namespace. 359 4.3. Private Claim Names 361 A producer and consumer of a JWT may agree to any claim name that is 362 not a Reserved Name Section 4.1 or a Public Name Section 4.2. Unlike 363 Public Names, these private names are subject to collision and should 364 be used with caution. 366 5. JWT Header 368 The members of the JSON object represented by the JWT Header describe 369 the cryptographic operations applied to the JWT and optionally, 370 additional properties of the JWT. The member names within the JWT 371 Header are referred to as Header Parameter Names. These names MUST 372 be unique; JWTs with duplicate Header Parameter Names MUST be 373 rejected. The corresponding values are referred to as Header 374 Parameter Values. 376 Implementations MUST understand the entire contents of the header; 377 otherwise, the JWT MUST be rejected for processing. 379 JWS Header Parameters are defined by [JWS]. JWE Header Parameters 380 are defined by [JWE]. This specification further specifies the use 381 of the following header parameter in both the cases where the JWT is 382 a JWS and where it is a JWE. 384 5.1. "typ" (Type) Header Parameter 386 The "typ" (type) header parameter is used to declare the type of this 387 object. If present, it is RECOMMENDED that its value be either "JWT" 388 or "urn:ietf:params:oauth:token-type:jwt" to indicate that this 389 object is a JWT. The "typ" value is case sensitive. Its value MUST 390 be a string. This header parameter is OPTIONAL. 392 5.2. "cty" (Content Type) Header Parameter 394 The "cty" (content type) header parameter is used to declare 395 structural information about the JWT. Its value MUST be a string. 397 In the normal case where nested signing or encryption operations are 398 not employed, the use of this header parameter is NOT RECOMMENDED. 399 In the case that nested signing or encryption is employed, the use of 400 this header parameter is REQUIRED; in this case, the value MUST be 401 "JWT", to indicate that a nested JWT is carried in this JWT. 403 The values used for the "cty" header parameter come from the same 404 value space as the "typ" header parameter, with the same rules 405 applying. 407 6. Plaintext JWTs 409 To support use cases where the JWT content is secured by a means 410 other than a signature and/or encryption contained within the token 411 (such as a signature on a data structure containing the token), JWTs 412 MAY also be created without a signature or encryption. A plaintext 413 JWT is a JWS using the "none" JWS "alg" header parameter value 414 defined in JSON Web Algorithms (JWA) [JWA]; it is a JWS with an empty 415 JWS Signature value. 417 6.1. Example Plaintext JWT 419 The following example JWT Header declares that the encoded object is 420 a Plaintext JWT: 421 {"alg":"none"} 423 Base64url encoding the bytes of the UTF-8 representation of the JWT 424 Header yields this Encoded JWT Header: 425 eyJhbGciOiJub25lIn0 427 The following is an example of a JWT Claims Set: 428 {"iss":"joe", 429 "exp":1300819380, 430 "http://example.com/is_root":true} 432 Base64url encoding the bytes of the UTF-8 representation of the JSON 433 Claims Set yields this Encoded JWS Payload (with line breaks for 434 display purposes only): 435 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 436 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 437 The Encoded JWS Signature is the empty string. 439 Concatenating these parts in this order with period characters 440 between the parts yields this complete JWT (with line breaks for 441 display purposes only): 442 eyJhbGciOiJub25lIn0 443 . 444 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 445 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 446 . 448 7. Rules for Creating and Validating a JWT 450 To create a JWT, one MUST perform these steps. The order of the 451 steps is not significant in cases where there are no dependencies 452 between the inputs and outputs of the steps. 454 1. Create a JWT Claims Set containing the desired claims. Note that 455 white space is explicitly allowed in the representation and no 456 canonicalization is performed before encoding. 458 2. Let the Message be the bytes of the UTF-8 representation of the 459 JWT Claims Set. 461 3. Create a JWT Header containing the desired set of header 462 parameters. The JWT MUST conform to either the [JWS] or [JWE] 463 specifications. Note that white space is explicitly allowed in 464 the representation and no canonicalization is performed before 465 encoding. 467 4. Base64url encode the bytes of the UTF-8 representation of the JWT 468 Header. Let this be the Encoded JWT Header. 470 5. Depending upon whether the JWT is a JWS or JWE, there are two 471 cases: 473 * If the JWT is a JWS, create a JWS using the JWT Header as the 474 JWS Header and the Message as the JWS Payload; all steps 475 specified in [JWS] for creating a JWS MUST be followed. 477 * Else, if the JWT is a JWE, create a JWE using the JWT Header 478 as the JWE Header and the Message as the JWE Plaintext; all 479 steps specified in [JWE] for creating a JWE MUST be followed. 481 6. If a nested signing or encryption operation will be performed, 482 let the Message be the JWS or JWE, and return to Step 3, using a 483 "cty" (content type) value of "JWT" in the new JWT Header created 484 in that step. 486 7. Otherwise, let the resulting JWT be the JWS or JWE. 488 When validating a JWT the following steps MUST be taken. The order 489 of the steps is not significant in cases where there are no 490 dependencies between the inputs and outputs of the steps. If any of 491 the listed steps fails then the token MUST be rejected for 492 processing. 494 1. The JWT MUST contain at least one period character. 496 2. Let the Encoded JWT Header be the portion of the JWT before the 497 first period character. 499 3. The Encoded JWT Header MUST be successfully base64url decoded 500 following the restriction given in this specification that no 501 padding characters have been used. 503 4. The resulting JWT Header MUST be completely valid JSON syntax 504 conforming to RFC 4627 [RFC4627]. 506 5. The resulting JWT Header MUST be validated to only include 507 parameters and values whose syntax and semantics are both 508 understood and supported. 510 6. Determine whether the JWT is a JWS or a JWE by examining the 511 "alg" (algorithm) header value and optionally, the "enc" 512 (encryption method) header value, if present. 514 7. Depending upon whether the JWT is a JWS or JWE, there are two 515 cases: 517 * If the JWT is a JWS, all steps specified in [JWS] for 518 validating a JWS MUST be followed. Let the Message be the 519 result of base64url decoding the JWS Payload. 521 * Else, if the JWT is a JWE, all steps specified in [JWE] for 522 validating a JWE MUST be followed. Let the Message be the 523 JWE Plaintext. 525 8. If the JWT Header contains a "cty" (content type) value of 526 "JWT", then the Message contains a JWT that was the subject of 527 nested signing or encryption operations. In this case, return 528 to Step 1, using the Message as the JWT. 530 9. Otherwise, let the JWT Claims Set be the Message. 532 10. The JWT Claims Set MUST be completely valid JSON syntax 533 conforming to RFC 4627 [RFC4627]. 535 11. When used in a security-related context, the JWT Claims Set MUST 536 be validated to only include claims whose syntax and semantics 537 are both understood and supported. 539 Processing a JWT inevitably requires comparing known strings to 540 values in the token. For example, in checking what the algorithm is, 541 the Unicode string encoding "alg" will be checked against the member 542 names in the JWT Header to see if there is a matching header 543 parameter name. A similar process occurs when determining if the 544 value of the "alg" header parameter represents a supported algorithm. 546 Comparisons between JSON strings and other Unicode strings MUST be 547 performed as specified below: 549 1. Remove any JSON applied escaping to produce an array of Unicode 550 code points. 552 2. Unicode Normalization [USA15] MUST NOT be applied at any point to 553 either the JSON string or to the string it is to be compared 554 against. 556 3. Comparisons between the two strings MUST be performed as a 557 Unicode code point to code point equality comparison. 559 8. Cryptographic Algorithms 561 JWTs use JSON Web Signature (JWS) [JWS] and JSON Web Encryption (JWE) 562 [JWE] to sign and/or encrypt the contents of the JWT. 564 Of the JWS signing algorithms, only HMAC SHA-256 and "none" MUST be 565 implemented by conforming JWT implementations. It is RECOMMENDED 566 that implementations also support the RSA SHA-256 and ECDSA P-256 567 SHA-256 algorithms. Support for other algorithms and key sizes is 568 OPTIONAL. 570 If an implementation provides encryption capabilities, of the JWE 571 encryption algorithms, only RSA-PKCS1-1.5 with 2048 bit keys, AES- 572 128-KW, AES-256-KW, AES-128-CBC, and AES-256-CBC MUST be implemented 573 by conforming implementations. It is RECOMMENDED that 574 implementations also support ECDH-ES with 256 bit keys, AES-128-GCM, 575 and AES-256-GCM. Support for other algorithms and key sizes is 576 OPTIONAL. 578 9. IANA Considerations 580 9.1. JSON Web Token Claims Registry 582 This specification establishes the IANA JSON Web Token Claims 583 registry for reserved JWT Claim Names. The registry records the 584 reserved Claim Name and a reference to the specification that defines 585 it. This specification registers the Claim Names defined in 586 Section 4.1. 588 Values are registered with a Specification Required [RFC5226] after a 589 two week review period on the [TBD]@ietf.org mailing list, on the 590 advice of one or more Designated Experts. However, to allow for the 591 allocation of values prior to publication, the Designated Expert(s) 592 may approve registration once they are satisfied that such a 593 specification will be published. 595 Registration requests must be sent to the [TBD]@ietf.org mailing list 596 for review and comment, with an appropriate subject (e.g., "Request 597 for access token type: example"). [[ Note to RFC-EDITOR: The name of 598 the mailing list should be determined in consultation with the IESG 599 and IANA. Suggested name: claims-reg-review. ]] 601 Within the review period, the Designated Expert(s) will either 602 approve or deny the registration request, communicating this decision 603 to the review list and IANA. Denials should include an explanation 604 and, if applicable, suggestions as to how to make the request 605 successful. 607 IANA must only accept registry updates from the Designated Expert(s), 608 and should direct all requests for registration to the review mailing 609 list. 611 9.1.1. Registration Template 613 Claim Name: 614 The name requested (e.g., "example"). 616 Change Controller: 617 For standards-track RFCs, state "IETF". For others, give the name 618 of the responsible party. Other details (e.g., postal address, 619 e-mail address, home page URI) may also be included. 621 Specification Document(s): 622 Reference to the document that specifies the parameter, preferably 623 including a URI that can be used to retrieve a copy of the 624 document. An indication of the relevant sections may also be 625 included, but is not required. 627 9.1.2. Initial Registry Contents 629 o Claim Name: "exp" 631 o Change Controller: IETF 633 o Specification Document(s): Section 4.1.1 of [[ this document ]] 635 o Claim Name: "nbf" 637 o Change Controller: IETF 639 o Specification Document(s): Section 4.1.2 of [[ this document ]] 641 o Claim Name: "iat" 643 o Change Controller: IETF 645 o Specification Document(s): Section 4.1.3 of [[ this document ]] 647 o Claim Name: "iss" 649 o Change Controller: IETF 651 o Specification Document(s): Section 4.1.4 of [[ this document ]] 653 o Claim Name: "aud" 655 o Change Controller: IETF 657 o Specification Document(s): Section 4.1.5 of [[ this document ]] 659 o Claim Name: "prn" 661 o Change Controller: IETF 663 o Specification Document(s): Section 4.1.6 of [[ this document ]] 665 o Claim Name: "jti" 667 o Change Controller: IETF 669 o Specification Document(s): Section 4.1.7 of [[ this document ]] 671 o Claim Name: "typ" 673 o Change Controller: IETF 674 o Specification Document(s): Section 4.1.8 of [[ this document ]] 676 9.2. Sub-Namespace Registration of urn:ietf:params:oauth:token-type:jwt 678 9.2.1. Registry Contents 680 This specification registers the value "token-type:jwt" in the IANA 681 urn:ietf:params:oauth registry established in An IETF URN Sub- 682 Namespace for OAuth [I-D.ietf-oauth-urn-sub-ns]. 684 o URN: urn:ietf:params:oauth:token-type:jwt 686 o Common Name: JSON Web Token (JWT) Token Type 688 o Change Controller: IETF 690 o Specification Document(s): [[this document]] 692 9.3. JSON Web Signature and Encryption Type Values Registration 694 9.3.1. Registry Contents 696 This specification registers the "JWT" type value in the IANA JSON 697 Web Signature and Encryption Type Values registry [JWS]: 699 o "typ" Header Parameter Value: "JWT" 701 o Abbreviation for MIME Type: application/jwt 703 o Change Controller: IETF 705 o Specification Document(s): Section 5.1 of [[ this document ]] 707 9.4. Media Type Registration 709 9.4.1. Registry Contents 711 This specification registers the "application/jwt" Media Type 712 [RFC2046] in the MIME Media Type registry [RFC4288] to indicate that 713 the content is a JWT. 715 o Type Name: application 717 o Subtype Name: jwt 719 o Required Parameters: n/a 720 o Optional Parameters: n/a 722 o Encoding considerations: JWT values are encoded as a series of 723 base64url encoded values (some of which may be the empty string) 724 separated by period ('.') characters 726 o Security Considerations: See the Security Considerations section 727 of this document 729 o Interoperability Considerations: n/a 731 o Published Specification: [[ this document ]] 733 o Applications that use this media type: OpenID Connect, Mozilla 734 Browser ID, Salesforce, Google, numerous others 736 o Additional Information: Magic number(s): n/a, File extension(s): 737 n/a, Macintosh file type code(s): n/a 739 o Person & email address to contact for further information: Michael 740 B. Jones, mbj@microsoft.com 742 o Intended Usage: COMMON 744 o Restrictions on Usage: none 746 o Author: Michael B. Jones, mbj@microsoft.com 748 o Change Controller: IETF 750 10. Security Considerations 752 All of the security issues faced by any cryptographic application 753 must be faced by a JWT/JWS/JWE/JWK agent. Among these issues are 754 protecting the user's private key, preventing various attacks, and 755 helping the user avoid mistakes such as inadvertently encrypting a 756 message for the wrong recipient. The entire list of security 757 considerations is beyond the scope of this document, but some 758 significant concerns are listed here. 760 All the security considerations in the JWS specification also apply 761 to JWT, as do the JWE security considerations when encryption is 762 employed. In particular, the JWS JSON Security Considerations and 763 Unicode Comparison Security Considerations apply equally to the JWT 764 Claims Set in the same manner that they do to the JWS Header. 766 11. Open Issues 768 [[ to be removed by the RFC editor before publication as an RFC ]] 770 The following items remain to be considered or done in this draft: 772 o Provide an example of an encrypted JWT. 774 12. References 776 12.1. Normative References 778 [I-D.ietf-oauth-urn-sub-ns] 779 Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace 780 for OAuth", draft-ietf-oauth-urn-sub-ns-05 (work in 781 progress), June 2012. 783 [JWA] Jones, M., "JSON Web Algorithms (JWA)", July 2012. 785 [JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web 786 Encryption (JWE)", July 2012. 788 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 789 Signature (JWS)", July 2012. 791 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 792 Extensions (MIME) Part Two: Media Types", RFC 2046, 793 November 1996. 795 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 796 Requirement Levels", BCP 14, RFC 2119, March 1997. 798 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 799 Internet: Timestamps", RFC 3339, July 2002. 801 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 802 10646", STD 63, RFC 3629, November 2003. 804 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 805 Resource Identifier (URI): Generic Syntax", STD 66, 806 RFC 3986, January 2005. 808 [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and 809 Registration Procedures", BCP 13, RFC 4288, December 2005. 811 [RFC4627] Crockford, D., "The application/json Media Type for 812 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 814 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 815 Encodings", RFC 4648, October 2006. 817 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 818 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 819 May 2008. 821 [USA15] Davis, M., Whistler, K., and M. Duerst, "Unicode 822 Normalization Forms", Unicode Standard Annex 15, 09 2009. 824 12.2. Informative References 826 [CanvasApp] 827 Facebook, "Canvas Applications", 2010. 829 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 830 September 2010. 832 [MagicSignatures] 833 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 834 Signatures", January 2011. 836 [OASIS.saml-core-2.0-os] 837 Cantor, S., Kemp, J., Philpott, R., and E. Maler, 838 "Assertions and Protocol for the OASIS Security Assertion 839 Markup Language (SAML) V2.0", OASIS Standard saml-core- 840 2.0-os, March 2005. 842 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 843 Language) XML-Signature Syntax and Processing", RFC 3275, 844 March 2002. 846 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 847 Unique IDentifier (UUID) URN Namespace", RFC 4122, 848 July 2005. 850 [SWT] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", 851 Version 0.9.5.1, November 2009. 853 [W3C.CR-xml11-20021015] 854 Cowan, J., "Extensible Markup Language (XML) 1.1", W3C 855 CR CR-xml11-20021015, October 2002. 857 Appendix A. Relationship of JWTs to SAML Tokens 859 SAML 2.0 [OASIS.saml-core-2.0-os] provides a standard for creating 860 tokens with much greater expressivity and more security options than 861 supported by JWTs. However, the cost of this flexibility and 862 expressiveness is both size and complexity. In addition, SAML's use 863 of XML [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] only 864 contributes to the size of SAML tokens. 866 JWTs are intended to provide a simple token format that is small 867 enough to fit into HTTP headers and query arguments in URIs. It does 868 this by supporting a much simpler token model than SAML and using the 869 JSON [RFC4627] object encoding syntax. It also supports securing 870 tokens using Message Authentication Codes (MACs) and digital 871 signatures using a smaller (and less flexible) format than XML DSIG. 873 Therefore, while JWTs can do some of the things SAML tokens do, JWTs 874 are not intended as a full replacement for SAML tokens, but rather as 875 a compromise token format to be used when space is at a premium. 877 Appendix B. Relationship of JWTs to Simple Web Tokens (SWTs) 879 Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets 880 of claims to be communicated between applications. For SWTs, both 881 the claim names and claim values are strings. For JWTs, while claim 882 names are strings, claim values can be any JSON type. Both token 883 types offer cryptographic protection of their content: SWTs with HMAC 884 SHA-256 and JWTs with a choice of algorithms, including HMAC SHA-256, 885 RSA SHA-256, and ECDSA P-256 SHA-256. 887 Appendix C. Acknowledgements 889 The authors acknowledge that the design of JWTs was intentionally 890 influenced by the design and simplicity of Simple Web Tokens [SWT] 891 and ideas for JSON tokens that Dick Hardt discussed within the OpenID 892 community. 894 Solutions for signing JSON content were previously explored by Magic 895 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 896 Applications [CanvasApp], all of which influenced this draft. Dirk 897 Balfanz, Yaron Y. Goland, John Panzer, and Paul Tarjan all made 898 significant contributions to the design of this specification. 900 Appendix D. Document History 902 [[ to be removed by the RFC editor before publication as an RFC ]] 904 -01 905 o Added the "cty" (content type) header parameter for declaring type 906 information about the secured content, as opposed to the "typ" 907 (type) header parameter, which declares type information about 908 this object. This significantly simplified nested JWTs. 910 o Moved description of how to determine whether a header is for a 911 JWS or a JWE from the JWT spec to the JWE spec. 913 o Changed registration requirements from RFC Required to 914 Specification Required with Expert Review. 916 o Added Registration Template sections for defined registries. 918 o Added Registry Contents sections to populate registry values. 920 o Added "Collision Resistant Namespace" to the terminology section. 922 o Numerous editorial improvements. 924 -00 926 o Created the initial IETF draft based upon 927 draft-jones-json-web-token-10 with no normative changes. 929 Authors' Addresses 931 Michael B. Jones 932 Microsoft 934 Email: mbj@microsoft.com 935 URI: http://self-issued.info/ 937 John Bradley 938 Ping Identity 940 Email: ve7jtb@ve7jtb.com 942 Nat Sakimura 943 Nomura Research Institute 945 Email: n-sakimura@nri.co.jp