idnits 2.17.1 draft-ietf-oauth-json-web-token-19.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 date (March 18, 2014) is 3692 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) -- Possible downref: Non-RFC (?) normative reference: ref. 'ECMAScript' ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 3 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: September 19, 2014 Ping Identity 6 N. Sakimura 7 NRI 8 March 18, 2014 10 JSON Web Token (JWT) 11 draft-ietf-oauth-json-web-token-19 13 Abstract 15 JSON Web Token (JWT) is a compact URL-safe means of representing 16 claims to be transferred between two parties. The claims in a JWT 17 are encoded as a JavaScript Object Notation (JSON) object that is 18 used as the payload of a JSON Web Signature (JWS) structure or as the 19 plaintext of a JSON Web Encryption (JWE) structure, enabling the 20 claims to be digitally signed or MACed and/or encrypted. 22 The suggested pronunciation of JWT is the same as the English word 23 "jot". 25 Status of this Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on September 19, 2014. 42 Copyright Notice 44 Copyright (c) 2014 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 60 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 61 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 62 3. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . 6 63 3.1. Example JWT . . . . . . . . . . . . . . . . . . . . . . . 6 64 4. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . . 8 65 4.1. Registered Claim Names . . . . . . . . . . . . . . . . . . 8 66 4.1.1. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . . 8 67 4.1.2. "sub" (Subject) Claim . . . . . . . . . . . . . . . . 9 68 4.1.3. "aud" (Audience) Claim . . . . . . . . . . . . . . . . 9 69 4.1.4. "exp" (Expiration Time) Claim . . . . . . . . . . . . 9 70 4.1.5. "nbf" (Not Before) Claim . . . . . . . . . . . . . . . 9 71 4.1.6. "iat" (Issued At) Claim . . . . . . . . . . . . . . . 9 72 4.1.7. "jti" (JWT ID) Claim . . . . . . . . . . . . . . . . . 10 73 4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 10 74 4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 10 75 5. JWT Header . . . . . . . . . . . . . . . . . . . . . . . . . . 10 76 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 11 77 5.2. "cty" (Content Type) Header Parameter . . . . . . . . . . 11 78 5.3. Replicating Claims as Header Parameters . . . . . . . . . 11 79 6. Plaintext JWTs . . . . . . . . . . . . . . . . . . . . . . . . 12 80 6.1. Example Plaintext JWT . . . . . . . . . . . . . . . . . . 12 81 7. Rules for Creating and Validating a JWT . . . . . . . . . . . 13 82 7.1. String Comparison Rules . . . . . . . . . . . . . . . . . 14 83 8. Implementation Requirements . . . . . . . . . . . . . . . . . 15 84 9. URI for Declaring that Content is a JWT . . . . . . . . . . . 15 85 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 86 10.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 16 87 10.1.1. Registration Template . . . . . . . . . . . . . . . . 17 88 10.1.2. Initial Registry Contents . . . . . . . . . . . . . . 17 89 10.2. Sub-Namespace Registration of 90 urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 18 91 10.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 18 92 10.3. Media Type Registration . . . . . . . . . . . . . . . . . 18 93 10.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 18 94 10.4. Registration of JWE Header Parameter Names . . . . . . . . 19 95 10.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 19 97 11. Security Considerations . . . . . . . . . . . . . . . . . . . 19 98 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 20 99 12.1. Normative References . . . . . . . . . . . . . . . . . . . 20 100 12.2. Informative References . . . . . . . . . . . . . . . . . . 21 101 Appendix A. JWT Examples . . . . . . . . . . . . . . . . . . . . 22 102 A.1. Example Encrypted JWT . . . . . . . . . . . . . . . . . . 22 103 A.2. Example Nested JWT . . . . . . . . . . . . . . . . . . . . 23 104 Appendix B. Relationship of JWTs to SAML Assertions . . . . . . . 25 105 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) . . 26 106 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 26 107 Appendix E. Document History . . . . . . . . . . . . . . . . . . 26 108 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 31 110 1. Introduction 112 JSON Web Token (JWT) is a compact claims representation format 113 intended for space constrained environments such as HTTP 114 Authorization headers and URI query parameters. JWTs encode claims 115 to be transmitted as a JavaScript Object Notation (JSON) [RFC7159] 116 object that is used as the payload of a JSON Web Signature (JWS) 117 [JWS] structure or as the plaintext of a JSON Web Encryption (JWE) 118 [JWE] structure, enabling the claims to be digitally signed or MACed 119 and/or encrypted. JWTs are always represented using the JWS Compact 120 Serialization or the JWE Compact Serialization. 122 The suggested pronunciation of JWT is the same as the English word 123 "jot". 125 1.1. Notational Conventions 127 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 128 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 129 "OPTIONAL" in this document are to be interpreted as described in Key 130 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 131 these words are used without being spelled in uppercase then they are 132 to be interpreted with their normal natural language meanings. 134 2. Terminology 136 JSON Web Token (JWT) 137 A string representing a set of claims as a JSON object that is 138 encoded in a JWS or JWE, enabling the claims to be digitally 139 signed or MACed and/or encrypted. 141 Base64url Encoding 142 Base64 encoding using the URL- and filename-safe character set 143 defined in Section 5 of RFC 4648 [RFC4648], with all trailing '=' 144 characters omitted (as permitted by Section 3.2) and without the 145 inclusion of any line breaks, white space, or other additional 146 characters. (See Appendix C of [JWS] for notes on implementing 147 base64url encoding without padding.) 149 JWT Header 150 A JSON object that describes the cryptographic operations applied 151 to the JWT. When the JWT is digitally signed or MACed, the JWT 152 Header is a JWS Header. When the JWT is encrypted, the JWT Header 153 is a JWE Header. 155 Header Parameter 156 A name/value pair that is member of the JWT Header. 158 Header Parameter Name 159 The name of a member of the JWT Header. 161 Header Parameter Value 162 The value of a member of the JWT Header. 164 JWT Claims Set 165 A JSON object that contains the Claims conveyed by the JWT. 167 Claim 168 A piece of information asserted about a subject. A Claim is 169 represented as a name/value pair consisting of a Claim Name and a 170 Claim Value. 172 Claim Name 173 The name portion of a Claim representation. A Claim Name is 174 always a string. 176 Claim Value 177 The value portion of a Claim representation. A Claim Value can be 178 any JSON value. 180 Encoded JWT Header 181 Base64url encoding of the JWT Header. 183 Nested JWT 184 A JWT in which nested signing and/or encryption are employed. In 185 nested JWTs, a JWT is used as the payload or plaintext value of an 186 enclosing JWS or JWE structure, respectively. 188 Plaintext JWT 189 A JWT whose Claims are not integrity protected or encrypted. 191 Collision-Resistant Name 192 A name in a namespace that enables names to be allocated in a 193 manner such that they are highly unlikely to collide with other 194 names. Examples of collision-resistant namespaces include: Domain 195 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 196 X.670 Recommendation series, and Universally Unique IDentifiers 197 (UUIDs) [RFC4122]. When using an administratively delegated 198 namespace, the definer of a name needs to take reasonable 199 precautions to ensure they are in control of the portion of the 200 namespace they use to define the name. 202 StringOrURI 203 A JSON string value, with the additional requirement that while 204 arbitrary string values MAY be used, any value containing a ":" 205 character MUST be a URI [RFC3986]. StringOrURI values are 206 compared as case-sensitive strings with no transformations or 207 canonicalizations applied. 209 IntDate 210 A JSON numeric value representing the number of seconds from 1970- 211 01-01T0:0:0Z UTC until the specified UTC date/time. See RFC 3339 212 [RFC3339] for details regarding date/times in general and UTC in 213 particular. 215 3. JSON Web Token (JWT) Overview 217 JWTs represent a set of claims as a JSON object that is encoded in a 218 JWS and/or JWE structure. This JSON object is the JWT Claims Set. As 219 per Section 4 of [RFC7159], the JSON object consists of zero or more 220 name/value pairs (or members), where the names are strings and the 221 values are arbitrary JSON values. These members are the claims 222 represented by the JWT. 224 The member names within the JWT Claims Set are referred to as Claim 225 Names. The corresponding values are referred to as Claim Values. 227 The contents of the JWT Header describe the cryptographic operations 228 applied to the JWT Claims Set. If the JWT Header is a JWS Header, the 229 JWT is represented as a JWS, and the claims are digitally signed or 230 MACed, with the JWT Claims Set being the JWS Payload. If the JWT 231 Header is a JWE Header, the JWT is represented as a JWE, and the 232 claims are encrypted, with the JWT Claims Set being the input 233 Plaintext. A JWT may be enclosed in another JWE or JWS structure to 234 create a Nested JWT, enabling nested signing and encryption to be 235 performed. 237 A JWT is represented as a sequence of URL-safe parts separated by 238 period ('.') characters. Each part contains a base64url encoded 239 value. The number of parts in the JWT is dependent upon the 240 representation of the resulting JWS or JWE object using the JWS 241 Compact Serialization or the JWE Compact Serialization. 243 3.1. Example JWT 245 The following example JWT Header declares that the encoded object is 246 a JSON Web Token (JWT) and the JWT is a JWS that is MACed using the 247 HMAC SHA-256 algorithm: 249 {"typ":"JWT", 250 "alg":"HS256"} 252 The following octet sequence is the UTF-8 representation of the JWT 253 Header/JWS Header above: 255 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 256 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 258 Base64url encoding the octets of the UTF-8 representation of the JWT 259 Header yields this Encoded JWT Header value (which is also the 260 underlying encoded JWS Header value): 262 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 264 The following is an example of a JWT Claims Set: 266 {"iss":"joe", 267 "exp":1300819380, 268 "http://example.com/is_root":true} 270 The following octet sequence, which is the UTF-8 representation of 271 the JWT Claims Set above, is the JWS Payload: 273 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 274 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 275 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 276 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 277 111, 116, 34, 58, 116, 114, 117, 101, 125] 279 Base64url encoding the JWS Payload yields this encoded JWS Payload 280 (with line breaks for display purposes only): 282 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly 283 9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ 285 Computing the MAC of the encoded JWS Header and encoded JWS Payload 286 with the HMAC SHA-256 algorithm and base64url encoding the HMAC value 287 in the manner specified in [JWS], yields this encoded JWS Signature: 289 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 291 Concatenating these encoded parts in this order with period ('.') 292 characters between the parts yields this complete JWT (with line 293 breaks for display purposes only): 295 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 296 . 297 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 298 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 299 . 300 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 302 This computation is illustrated in more detail in Appendix A.1 of 303 [JWS]. See Appendix A.1 for an example of an encrypted JWT. 305 4. JWT Claims 307 The JWT Claims Set represents a JSON object whose members are the 308 claims conveyed by the JWT. The Claim Names within a JWT Claims Set 309 MUST be unique; recipients MUST either reject JWTs with duplicate 310 Claim Names or use a JSON parser that returns only the lexically last 311 duplicate member name, as specified in Section 15.12 (The JSON 312 Object) of ECMAScript 5.1 [ECMAScript]. 314 The set of claims that a JWT must contain to be considered valid is 315 context-dependent and is outside the scope of this specification. 316 Specific applications of JWTs will require implementations to 317 understand and process some claims in particular ways. However, in 318 the absence of such requirements, all claims that are not understood 319 by implementations MUST be ignored. 321 There are three classes of JWT Claim Names: Registered Claim Names, 322 Public Claim Names, and Private Claim Names. 324 4.1. Registered Claim Names 326 The following Claim Names are registered in the IANA JSON Web Token 327 Claims registry defined in Section 10.1. None of the claims defined 328 below are intended to be mandatory to use or implement in all cases, 329 but rather, provide a starting point for a set of useful, 330 interoperable claims. Applications using JWTs should define which 331 specific claims they use and when they are required or optional. All 332 the names are short because a core goal of JWTs is for the 333 representation to be compact. 335 4.1.1. "iss" (Issuer) Claim 337 The "iss" (issuer) claim identifies the principal that issued the 338 JWT. The processing of this claim is generally application specific. 339 The "iss" value is a case-sensitive string containing a StringOrURI 340 value. Use of this claim is OPTIONAL. 342 4.1.2. "sub" (Subject) Claim 344 The "sub" (subject) claim identifies the principal that is the 345 subject of the JWT. The Claims in a JWT are normally statements 346 about the subject. The subject value MAY be scoped to be locally 347 unique in the context of the issuer or MAY be globally unique. The 348 processing of this claim is generally application specific. The 349 "sub" value is a case-sensitive string containing a StringOrURI 350 value. Use of this claim is OPTIONAL. 352 4.1.3. "aud" (Audience) Claim 354 The "aud" (audience) claim identifies the recipients that the JWT is 355 intended for. Each principal intended to process the JWT MUST 356 identify itself with a value in the audience claim. If the principal 357 processing the claim does not identify itself with a value in the 358 "aud" claim when this claim is present, then the JWT MUST be 359 rejected. In the general case, the "aud" value is an array of case- 360 sensitive strings, each containing a StringOrURI value. In the 361 special case when the JWT has one audience, the "aud" value MAY be a 362 single case-sensitive string containing a StringOrURI value. The 363 interpretation of audience values is generally application specific. 364 Use of this claim is OPTIONAL. 366 4.1.4. "exp" (Expiration Time) Claim 368 The "exp" (expiration time) claim identifies the expiration time on 369 or after which the JWT MUST NOT be accepted for processing. The 370 processing of the "exp" claim requires that the current date/time 371 MUST be before the expiration date/time listed in the "exp" claim. 372 Implementers MAY provide for some small leeway, usually no more than 373 a few minutes, to account for clock skew. Its value MUST be a number 374 containing an IntDate value. Use of this claim is OPTIONAL. 376 4.1.5. "nbf" (Not Before) Claim 378 The "nbf" (not before) claim identifies the time before which the JWT 379 MUST NOT be accepted for processing. The processing of the "nbf" 380 claim requires that the current date/time MUST be after or equal to 381 the not-before date/time listed in the "nbf" claim. Implementers MAY 382 provide for some small leeway, usually no more than a few minutes, to 383 account for clock skew. Its value MUST be a number containing an 384 IntDate value. Use of this claim is OPTIONAL. 386 4.1.6. "iat" (Issued At) Claim 388 The "iat" (issued at) claim identifies the time at which the JWT was 389 issued. This claim can be used to determine the age of the JWT. Its 390 value MUST be a number containing an IntDate value. Use of this 391 claim is OPTIONAL. 393 4.1.7. "jti" (JWT ID) Claim 395 The "jti" (JWT ID) claim provides a unique identifier for the JWT. 396 The identifier value MUST be assigned in a manner that ensures that 397 there is a negligible probability that the same value will be 398 accidentally assigned to a different data object. The "jti" claim 399 can be used to prevent the JWT from being replayed. The "jti" value 400 is a case-sensitive string. Use of this claim is OPTIONAL. 402 4.2. Public Claim Names 404 Claim Names can be defined at will by those using JWTs. However, in 405 order to prevent collisions, any new Claim Name should either be 406 registered in the IANA JSON Web Token Claims registry defined in 407 Section 10.1 or be a Public Name: a value that contains a Collision- 408 Resistant Name. In each case, the definer of the name or value needs 409 to take reasonable precautions to make sure they are in control of 410 the part of the namespace they use to define the Claim Name. 412 4.3. Private Claim Names 414 A producer and consumer of a JWT MAY agree to use Claim Names that 415 are Private Names: names that are not Registered Claim Names 416 Section 4.1 or Public Claim Names Section 4.2. Unlike Public Claim 417 Names, Private Claim Names are subject to collision and should be 418 used with caution. 420 5. JWT Header 422 The members of the JSON object represented by the JWT Header describe 423 the cryptographic operations applied to the JWT and optionally, 424 additional properties of the JWT. The member names within the JWT 425 Header are referred to as Header Parameter Names. These names MUST 426 be unique; recipients MUST either reject JWTs with duplicate Header 427 Parameter Names or use a JSON parser that returns only the lexically 428 last duplicate member name, as specified in Section 15.12 (The JSON 429 Object) of ECMAScript 5.1 [ECMAScript]. The corresponding values are 430 referred to as Header Parameter Values. 432 JWS Header Parameters are defined by [JWS]. JWE Header Parameters 433 are defined by [JWE]. This specification further specifies the use 434 of the following Header Parameters in both the cases where the JWT is 435 a JWS and where it is a JWE. 437 5.1. "typ" (Type) Header Parameter 439 The "typ" (type) Header Parameter defined by [JWS] and [JWE] is used 440 to declare the MIME Media Type [IANA.MediaTypes] of this complete JWT 441 in contexts where this is useful to the application. This parameter 442 has no effect upon the JWT processing. If present, it is RECOMMENDED 443 that its value be "JWT" to indicate that this object is a JWT. While 444 media type names are not case-sensitive, it is RECOMMENDED that "JWT" 445 always be spelled using uppercase characters for compatibility with 446 legacy implementations. Use of this Header Parameter is OPTIONAL. 448 5.2. "cty" (Content Type) Header Parameter 450 The "cty" (content type) Header Parameter defined by [JWS] and [JWE] 451 is used by this specification to convey structural information about 452 the JWT. 454 In the normal case where nested signing or encryption operations are 455 not employed, the use of this Header Parameter is NOT RECOMMENDED. 456 In the case that nested signing or encryption is employed, this 457 Header Parameter MUST be present; in this case, the value MUST be 458 "JWT", to indicate that a Nested JWT is carried in this JWT. While 459 media type names are not case-sensitive, it is RECOMMENDED that "JWT" 460 always be spelled using uppercase characters for compatibility with 461 legacy implementations. See Appendix A.2 for an example of a Nested 462 JWT. 464 5.3. Replicating Claims as Header Parameters 466 In some applications using encrypted JWTs, it is useful to have an 467 unencrypted representation of some Claims. This might be used, for 468 instance, in application processing rules to determine whether and 469 how to process the JWT before it is decrypted. 471 This specification allows Claims present in the JWT Claims Set to be 472 replicated as Header Parameters in a JWT that is a JWE, as needed by 473 the application. If such replicated Claims are present, the 474 application receiving them SHOULD verify that their values are 475 identical, unless the application defines other specific processing 476 rules for these Claims. It is the responsibility of the application 477 to ensure that only claims that are safe to be transmitted in an 478 unencrypted manner are replicated as Header Parameter Values in the 479 JWT. 481 Section 10.4.1 of this specification registers the "iss" (issuer), 482 "sub" (subject), and "aud" (audience) Header Parameter Names for the 483 purpose of providing unencrypted replicas of these Claims in 484 encrypted JWTs for applications that need them. Other specifications 485 MAY similarly register other names that are registered Claim Names as 486 Header Parameter Names, as needed. 488 6. Plaintext JWTs 490 To support use cases where the JWT content is secured by a means 491 other than a signature and/or encryption contained within the JWT 492 (such as a signature on a data structure containing the JWT), JWTs 493 MAY also be created without a signature or encryption. A plaintext 494 JWT is a JWS using the "none" JWS "alg" Header Parameter Value 495 defined in JSON Web Algorithms (JWA) [JWA]; it is a JWS with the 496 empty string for its JWS Signature value. 498 6.1. Example Plaintext JWT 500 The following example JWT Header declares that the encoded object is 501 a Plaintext JWT: 503 {"alg":"none"} 505 Base64url encoding the octets of the UTF-8 representation of the JWT 506 Header yields this Encoded JWT Header: 508 eyJhbGciOiJub25lIn0 510 The following is an example of a JWT Claims Set: 512 {"iss":"joe", 513 "exp":1300819380, 514 "http://example.com/is_root":true} 516 Base64url encoding the octets of the UTF-8 representation of the JWT 517 Claims Set yields this encoded JWS Payload (with line breaks for 518 display purposes only): 520 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 521 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 523 The encoded JWS Signature is the empty string. 525 Concatenating these encoded parts in this order with period ('.') 526 characters between the parts yields this complete JWT (with line 527 breaks for display purposes only): 529 eyJhbGciOiJub25lIn0 530 . 531 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 532 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 533 . 535 7. Rules for Creating and Validating a JWT 537 To create a JWT, the following steps MUST be taken. The order of the 538 steps is not significant in cases where there are no dependencies 539 between the inputs and outputs of the steps. 541 1. Create a JWT Claims Set containing the desired claims. Note that 542 white space is explicitly allowed in the representation and no 543 canonicalization need be performed before encoding. 545 2. Let the Message be the octets of the UTF-8 representation of the 546 JWT Claims Set. 548 3. Create a JWT Header containing the desired set of Header 549 Parameters. The JWT MUST conform to either the [JWS] or [JWE] 550 specifications. Note that white space is explicitly allowed in 551 the representation and no canonicalization need be performed 552 before encoding. 554 4. Depending upon whether the JWT is a JWS or JWE, there are two 555 cases: 557 * If the JWT is a JWS, create a JWS using the JWT Header as the 558 JWS Header and the Message as the JWS Payload; all steps 559 specified in [JWS] for creating a JWS MUST be followed. 561 * Else, if the JWT is a JWE, create a JWE using the JWT Header 562 as the JWE Header and the Message as the JWE Plaintext; all 563 steps specified in [JWE] for creating a JWE MUST be followed. 565 5. If a nested signing or encryption operation will be performed, 566 let the Message be the JWS or JWE, and return to Step 3, using a 567 "cty" (content type) value of "JWT" in the new JWT Header created 568 in that step. 570 6. Otherwise, let the resulting JWT be the JWS or JWE. 572 When validating a JWT, the following steps MUST be taken. The order 573 of the steps is not significant in cases where there are no 574 dependencies between the inputs and outputs of the steps. If any of 575 the listed steps fails then the JWT MUST be rejected for processing. 577 1. The JWT MUST contain at least one period ('.') character. 579 2. Let the Encoded JWT Header be the portion of the JWT before the 580 first period ('.') character. 582 3. The Encoded JWT Header MUST be successfully base64url decoded 583 following the restriction given in this specification that no 584 padding characters have been used. 586 4. The resulting JWT Header MUST be completely valid JSON syntax 587 conforming to [RFC7159]. 589 5. The resulting JWT Header MUST be validated to only include 590 parameters and values whose syntax and semantics are both 591 understood and supported or that are specified as being ignored 592 when not understood. 594 6. Determine whether the JWT is a JWS or a JWE using any of the 595 methods described in Section 9 of [JWE]. 597 7. Depending upon whether the JWT is a JWS or JWE, there are two 598 cases: 600 * If the JWT is a JWS, all steps specified in [JWS] for 601 validating a JWS MUST be followed. Let the Message be the 602 result of base64url decoding the JWS Payload. 604 * Else, if the JWT is a JWE, all steps specified in [JWE] for 605 validating a JWE MUST be followed. Let the Message be the 606 JWE Plaintext. 608 8. If the JWT Header contains a "cty" (content type) value of 609 "JWT", then the Message is a JWT that was the subject of nested 610 signing or encryption operations. In this case, return to Step 611 1, using the Message as the JWT. 613 9. Otherwise, let the JWT Claims Set be the Message. 615 10. The JWT Claims Set MUST be completely valid JSON syntax 616 conforming to [RFC7159]. 618 7.1. String Comparison Rules 620 Processing a JWT inevitably requires comparing known strings to 621 values in JSON objects. For example, in checking what the algorithm 622 is, the Unicode string encoding "alg" will be checked against the 623 member names in the JWT Header to see if there is a matching Header 624 Parameter Name. 626 Comparisons between JSON strings and other Unicode strings MUST be 627 performed by comparing Unicode code points without normalization, as 628 specified in the String Comparison Rules in Section 5.3 of [JWS]. 630 8. Implementation Requirements 632 This section defines which algorithms and features of this 633 specification are mandatory to implement. Applications using this 634 specification can impose additional requirements upon implementations 635 that they use. For instance, an application might require support 636 for encrypted JWTs and Nested JWTs; another might require support for 637 signing JWTs with ECDSA using the P-256 curve and the SHA-256 hash 638 algorithm ("ES256"). 640 Of the signature and MAC algorithms specified in JSON Web Algorithms 641 (JWA) [JWA], only HMAC SHA-256 ("HS256") and "none" MUST be 642 implemented by conforming JWT implementations. It is RECOMMENDED 643 that implementations also support RSASSA-PKCS1-V1_5 with the SHA-256 644 hash algorithm ("RS256") and ECDSA using the P-256 curve and the SHA- 645 256 hash algorithm ("ES256"). Support for other algorithms and key 646 sizes is OPTIONAL. 648 Support for encrypted JWTs is OPTIONAL. If an implementation 649 provides encryption capabilities, of the encryption algorithms 650 specified in [JWA], only RSAES-PKCS1-V1_5 with 2048 bit keys 651 ("RSA1_5"), AES Key Wrap with 128 and 256 bit keys ("A128KW" and 652 "A256KW"), and the composite authenticated encryption algorithm using 653 AES CBC and HMAC SHA-2 ("A128CBC-HS256" and "A256CBC-HS512") MUST be 654 implemented by conforming implementations. It is RECOMMENDED that 655 implementations also support using ECDH-ES to agree upon a key used 656 to wrap the Content Encryption Key ("ECDH-ES+A128KW" and 657 "ECDH-ES+A256KW") and AES in Galois/Counter Mode (GCM) with 128 bit 658 and 256 bit keys ("A128GCM" and "A256GCM"). Support for other 659 algorithms and key sizes is OPTIONAL. 661 Support for Nested JWTs is OPTIONAL. 663 9. URI for Declaring that Content is a JWT 665 This specification registers the URN 666 "urn:ietf:params:oauth:token-type:jwt" for use by applications that 667 declare content types using URIs (rather than, for instance, MIME 668 Media Types) to indicate that the content referred to is a JWT. 670 10. IANA Considerations 672 10.1. JSON Web Token Claims Registry 674 This specification establishes the IANA JSON Web Token Claims 675 registry for JWT Claim Names. The registry records the Claim Name 676 and a reference to the specification that defines it. This 677 specification registers the Claim Names defined in Section 4.1. 679 Values are registered with a Specification Required [RFC5226] after a 680 two-week review period on the [TBD]@ietf.org mailing list, on the 681 advice of one or more Designated Experts. However, to allow for the 682 allocation of values prior to publication, the Designated Expert(s) 683 may approve registration once they are satisfied that such a 684 specification will be published. 686 Registration requests must be sent to the [TBD]@ietf.org mailing list 687 for review and comment, with an appropriate subject (e.g., "Request 688 for access token type: example"). [[ Note to the RFC Editor: The name 689 of the mailing list should be determined in consultation with the 690 IESG and IANA. Suggested name: jwt-reg-review. ]] 692 Within the review period, the Designated Expert(s) will either 693 approve or deny the registration request, communicating this decision 694 to the review list and IANA. Denials should include an explanation 695 and, if applicable, suggestions as to how to make the request 696 successful. Registration requests that are undetermined for a period 697 longer than 21 days can be brought to the IESG's attention (using the 698 iesg@iesg.org mailing list) for resolution. 700 Criteria that should be applied by the Designated Expert(s) includes 701 determining whether the proposed registration duplicates existing 702 functionality, determining whether it is likely to be of general 703 applicability or whether it is useful only for a single application, 704 and whether the registration makes sense. 706 IANA must only accept registry updates from the Designated Expert(s) 707 and should direct all requests for registration to the review mailing 708 list. 710 It is suggested that multiple Designated Experts be appointed who are 711 able to represent the perspectives of different applications using 712 this specification, in order to enable broadly-informed review of 713 registration decisions. In cases where a registration decision could 714 be perceived as creating a conflict of interest for a particular 715 Expert, that Expert should defer to the judgment of the other 716 Expert(s). 718 10.1.1. Registration Template 720 Claim Name: 721 The name requested (e.g., "example"). Because a core goal of this 722 specification is for the resulting representations to be compact, 723 it is RECOMMENDED that the name be short -- not to exceed 8 724 characters without a compelling reason to do so. This name is 725 case-sensitive. Names may not match other registered names in a 726 case-insensitive manner unless the Designated Expert(s) state that 727 there is a compelling reason to allow an exception in this 728 particular case. 730 Claim Description: 731 Brief description of the Claim (e.g., "Example description"). 733 Change Controller: 734 For Standards Track RFCs, state "IESG". For others, give the name 735 of the responsible party. Other details (e.g., postal address, 736 email address, home page URI) may also be included. 738 Specification Document(s): 739 Reference to the document(s) that specify the parameter, 740 preferably including URI(s) that can be used to retrieve copies of 741 the document(s). An indication of the relevant sections may also 742 be included but is not required. 744 10.1.2. Initial Registry Contents 746 o Claim Name: "iss" 747 o Claim Description: Issuer 748 o Change Controller: IESG 749 o Specification Document(s): Section 4.1.1 of [[ this document ]] 751 o Claim Name: "sub" 752 o Claim Description: Subject 753 o Change Controller: IESG 754 o Specification Document(s): Section 4.1.2 of [[ this document ]] 756 o Claim Name: "aud" 757 o Claim Description: Audience 758 o Change Controller: IESG 759 o Specification Document(s): Section 4.1.3 of [[ this document ]] 761 o Claim Name: "exp" 762 o Claim Description: Expiration Time 763 o Change Controller: IESG 764 o Specification Document(s): Section 4.1.4 of [[ this document ]] 766 o Claim Name: "nbf" 767 o Claim Description: Not Before 768 o Change Controller: IESG 769 o Specification Document(s): Section 4.1.5 of [[ this document ]] 771 o Claim Name: "iat" 772 o Claim Description: Issued At 773 o Change Controller: IESG 774 o Specification Document(s): Section 4.1.6 of [[ this document ]] 776 o Claim Name: "jti" 777 o Claim Description: JWT ID 778 o Change Controller: IESG 779 o Specification Document(s): Section 4.1.7 of [[ this document ]] 781 10.2. Sub-Namespace Registration of 782 urn:ietf:params:oauth:token-type:jwt 784 10.2.1. Registry Contents 786 This specification registers the value "token-type:jwt" in the IANA 787 urn:ietf:params:oauth registry established in An IETF URN Sub- 788 Namespace for OAuth [RFC6755], which can be used to indicate that the 789 content is a JWT. 791 o URN: urn:ietf:params:oauth:token-type:jwt 792 o Common Name: JSON Web Token (JWT) Token Type 793 o Change Controller: IESG 794 o Specification Document(s): [[this document]] 796 10.3. Media Type Registration 798 10.3.1. Registry Contents 800 This specification registers the "application/jwt" Media Type 801 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes], which 802 can be used to indicate that the content is a JWT. 804 o Type Name: application 805 o Subtype Name: jwt 806 o Required Parameters: n/a 807 o Optional Parameters: n/a 808 o Encoding considerations: 8bit; JWT values are encoded as a series 809 of base64url encoded values (some of which may be the empty 810 string) separated by period ('.') characters. 812 o Security Considerations: See the Security Considerations section 813 of [[ this document ]] 814 o Interoperability Considerations: n/a 815 o Published Specification: [[ this document ]] 816 o Applications that use this media type: OpenID Connect, Mozilla 817 Persona, Salesforce, Google, numerous others 818 o Additional Information: Magic number(s): n/a, File extension(s): 819 n/a, Macintosh file type code(s): n/a 820 o Person & email address to contact for further information: Michael 821 B. Jones, mbj@microsoft.com 822 o Intended Usage: COMMON 823 o Restrictions on Usage: none 824 o Author: Michael B. Jones, mbj@microsoft.com 825 o Change Controller: IESG 827 10.4. Registration of JWE Header Parameter Names 829 This specification registers specific Claim Names defined in 830 Section 4.1 in the IANA JSON Web Signature and Encryption Header 831 Parameters registry defined in [JWS] for use by Claims replicated as 832 Header Parameters, per Section 5.3. 834 10.4.1. Registry Contents 836 o Header Parameter Name: "iss" 837 o Header Parameter Description: Issuer 838 o Header Parameter Usage Location(s): JWE 839 o Change Controller: IESG 840 o Specification Document(s): Section 4.1.1 of [[ this document ]] 842 o Header Parameter Name: "sub" 843 o Header Parameter Description: Subject 844 o Header Parameter Usage Location(s): JWE 845 o Change Controller: IESG 846 o Specification Document(s): Section 4.1.2 of [[ this document ]] 848 o Header Parameter Name: "aud" 849 o Header Parameter Description: Audience 850 o Header Parameter Usage Location(s): JWE 851 o Change Controller: IESG 852 o Specification Document(s): Section 4.1.3 of [[ this document ]] 854 11. Security Considerations 856 All of the security issues faced by any cryptographic application 857 must be faced by a JWT/JWS/JWE/JWK agent. Among these issues are 858 protecting the user's private and symmetric keys, preventing various 859 attacks, and helping the user avoid mistakes such as inadvertently 860 encrypting a message for the wrong recipient. The entire list of 861 security considerations is beyond the scope of this document. 863 All the security considerations in the JWS specification also apply 864 to JWT, as do the JWE security considerations when encryption is 865 employed. In particular, the JWS JSON Security Considerations and 866 Unicode Comparison Security Considerations apply equally to the JWT 867 Claims Set in the same manner that they do to the JWS Header. 869 While syntactically, the signing and encryption operations for Nested 870 JWTs may be applied in any order, normally senders should sign the 871 message and then encrypt the result (thus encrypting the signature). 872 This prevents attacks in which the signature is stripped, leaving 873 just an encrypted message, as well as providing privacy for the 874 signer. Furthermore, signatures over encrypted text are not 875 considered valid in many jurisdictions. 877 Note that potential concerns about security issues related to the 878 order of signing and encryption operations are already addressed by 879 the underlying JWS and JWE specifications; in particular, because JWE 880 only supports the use of authenticated encryption algorithms, 881 cryptographic concerns about the potential need to sign after 882 encryption that apply in many contexts do not apply to this 883 specification. 885 The contents of a JWT cannot be relied upon in a trust decision 886 unless its contents have been cryptographically secured and bound to 887 the context necessary for the trust decision. In particular, the 888 key(s) used to sign and/or encrypt the JWT will typically need to 889 verifiably be under the control of the party identified as the issuer 890 of the JWT. 892 12. References 894 12.1. Normative References 896 [ECMAScript] 897 Ecma International, "ECMAScript Language Specification, 898 5.1 Edition", ECMA 262, June 2011. 900 [IANA.MediaTypes] 901 Internet Assigned Numbers Authority (IANA), "MIME Media 902 Types", 2005. 904 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 905 draft-ietf-jose-json-web-algorithms (work in progress), 906 March 2014. 908 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 909 draft-ietf-jose-json-web-encryption (work in progress), 910 March 2014. 912 [JWK] Jones, M., "JSON Web Key (JWK)", 913 draft-ietf-jose-json-web-key (work in progress), 914 March 2014. 916 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 917 Signature (JWS)", draft-ietf-jose-json-web-signature (work 918 in progress), March 2014. 920 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 921 Extensions (MIME) Part Two: Media Types", RFC 2046, 922 November 1996. 924 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 925 Requirement Levels", BCP 14, RFC 2119, March 1997. 927 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 928 Resource Identifier (URI): Generic Syntax", STD 66, 929 RFC 3986, January 2005. 931 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 932 Encodings", RFC 4648, October 2006. 934 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 935 Interchange Format", RFC 7159, March 2014. 937 12.2. Informative References 939 [CanvasApp] 940 Facebook, "Canvas Applications", 2010. 942 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 943 September 2010. 945 [MagicSignatures] 946 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 947 Signatures", January 2011. 949 [OASIS.saml-core-2.0-os] 950 Cantor, S., Kemp, J., Philpott, R., and E. Maler, 951 "Assertions and Protocol for the OASIS Security Assertion 952 Markup Language (SAML) V2.0", OASIS Standard saml-core- 953 2.0-os, March 2005. 955 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 956 Language) XML-Signature Syntax and Processing", RFC 3275, 957 March 2002. 959 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 960 Internet: Timestamps", RFC 3339, July 2002. 962 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 963 Unique IDentifier (UUID) URN Namespace", RFC 4122, 964 July 2005. 966 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 967 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 968 May 2008. 970 [RFC6755] Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace 971 for OAuth", RFC 6755, October 2012. 973 [SWT] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", 974 Version 0.9.5.1, November 2009. 976 [W3C.CR-xml11-20021015] 977 Cowan, J., "Extensible Markup Language (XML) 1.1", W3C 978 CR CR-xml11-20021015, October 2002. 980 [W3C.REC-xml-c14n-20010315] 981 Boyer, J., "Canonical XML Version 1.0", World Wide Web 982 Consortium Recommendation REC-xml-c14n-20010315, 983 March 2001, 984 . 986 Appendix A. JWT Examples 988 This section contains examples of JWTs. For other example JWTs, see 989 Section 6.1 and Appendices A.1, A.2, and A.3 of [JWS]. 991 A.1. Example Encrypted JWT 993 This example encrypts the same claims as used in Section 3.1 to the 994 recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 996 The following example JWE Header (with line breaks for display 997 purposes only) declares that: 999 o the Content Encryption Key is encrypted to the recipient using the 1000 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and 1002 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 1003 algorithm to produce the Ciphertext. 1005 {"alg":"RSA1_5","enc":"A128CBC-HS256"} 1007 Other than using the octets of the UTF-8 representation of the JWT 1008 Claims Set from Section 3.1 as the plaintext value, the computation 1009 of this JWT is identical to the computation of the JWE in Appendix 1010 A.2 of [JWE], including the keys used. 1012 The final result in this example (with line breaks for display 1013 purposes only) is: 1015 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. 1016 QR1Owv2ug2WyPBnbQrRARTeEk9kDO2w8qDcjiHnSJflSdv1iNqhWXaKH4MqAkQtM 1017 oNfABIPJaZm0HaA415sv3aeuBWnD8J-Ui7Ah6cWafs3ZwwFKDFUUsWHSK-IPKxLG 1018 TkND09XyjORj_CHAgOPJ-Sd8ONQRnJvWn_hXV1BNMHzUjPyYwEsRhDhzjAD26ima 1019 sOTsgruobpYGoQcXUwFDn7moXPRfDE8-NoQX7N7ZYMmpUDkR-Cx9obNGwJQ3nM52 1020 YCitxoQVPzjbl7WBuB7AohdBoZOdZ24WlN1lVIeh8v1K4krB8xgKvRU8kgFrEn_a 1021 1rZgN5TiysnmzTROF869lQ. 1022 AxY8DCtDaGlsbGljb3RoZQ. 1023 MKOle7UQrG6nSxTLX6Mqwt0orbHvAKeWnDYvpIAeZ72deHxz3roJDXQyhxx0wKaM 1024 HDjUEOKIwrtkHthpqEanSBNYHZgmNOV7sln1Eu9g3J8. 1025 fiK51VwhsxJ-siBMR-YFiA 1027 A.2. Example Nested JWT 1029 This example shows how a JWT can be used as the payload of a JWE or 1030 JWS to create a Nested JWT. In this case, the JWT Claims Set is 1031 first signed, and then encrypted. 1033 The inner signed JWT is identical to the example in Appendix A.2 of 1034 [JWS]. Therefore, its computation is not repeated here. This 1035 example then encrypts this inner JWT to the recipient using RSAES- 1036 PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 1038 The following example JWE Header (with line breaks for display 1039 purposes only) declares that: 1041 o the Content Encryption Key is encrypted to the recipient using the 1042 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key, 1044 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 1045 algorithm to produce the Ciphertext, and 1047 o the Plaintext is itself a JWT. 1049 {"alg":"RSA1_5","enc":"A128CBC-HS256","cty":"JWT"} 1051 Base64url encoding the octets of the UTF-8 representation of the JWE 1052 Header yields this encoded JWE Header value: 1054 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldUIn0 1056 The computation of this JWT is identical to the computation of the 1057 JWE in Appendix A.2 of [JWE], other than that different JWE Header, 1058 Plaintext, Initialization Vector, and Content Encryption Key values 1059 are used. (The RSA key used is the same.) 1061 The Payload used is the octets of the ASCII representation of the JWT 1062 at the end of Appendix Section A.2.1 of [JWS] (with all whitespace 1063 and line breaks removed), which is a sequence of 458 octets. 1065 The Initialization Vector value used is: 1067 [82, 101, 100, 109, 111, 110, 100, 32, 87, 65, 32, 57, 56, 48, 53, 1068 50] 1070 This example uses the Content Encryption Key represented in JSON Web 1071 Key [JWK] format below: 1073 {"kty":"oct", 1074 "k":"GawgguFyGrWKav7AX4VKUg" 1075 } 1077 The final result for this Nested JWT (with line breaks for display 1078 purposes only) is: 1080 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldU 1081 In0. 1082 g_hEwksO1Ax8Qn7HoN-BVeBoa8FXe0kpyk_XdcSmxvcM5_P296JXXtoHISr_DD_M 1083 qewaQSH4dZOQHoUgKLeFly-9RI11TG-_Ge1bZFazBPwKC5lJ6OLANLMd0QSL4fYE 1084 b9ERe-epKYE3xb2jfY1AltHqBO-PM6j23Guj2yDKnFv6WO72tteVzm_2n17SBFvh 1085 DuR9a2nHTE67pe0XGBUS_TK7ecA-iVq5COeVdJR4U4VZGGlxRGPLRHvolVLEHx6D 1086 YyLpw30Ay9R6d68YCLi9FYTq3hIXPK_-dmPlOUlKvPr1GgJzRoeC9G5qCvdcHWsq 1087 JGTO_z3Wfo5zsqwkxruxwA. 1088 UmVkbW9uZCBXQSA5ODA1Mg. 1089 VwHERHPvCNcHHpTjkoigx3_ExK0Qc71RMEParpatm0X_qpg-w8kozSjfNIPPXiTB 1090 BLXR65CIPkFqz4l1Ae9w_uowKiwyi9acgVztAi-pSL8GQSXnaamh9kX1mdh3M_TT 1091 -FZGQFQsFhu0Z72gJKGdfGE-OE7hS1zuBD5oEUfk0Dmb0VzWEzpxxiSSBbBAzP10 1092 l56pPfAtrjEYw-7ygeMkwBl6Z_mLS6w6xUgKlvW6ULmkV-uLC4FUiyKECK4e3WZY 1093 Kw1bpgIqGYsw2v_grHjszJZ-_I5uM-9RA8ycX9KqPRp9gc6pXmoU_-27ATs9XCvr 1094 ZXUtK2902AUzqpeEUJYjWWxSNsS-r1TJ1I-FMJ4XyAiGrfmo9hQPcNBYxPz3GQb2 1095 8Y5CLSQfNgKSGt0A4isp1hBUXBHAndgtcslt7ZoQJaKe_nNJgNliWtWpJ_ebuOpE 1096 l8jdhehdccnRMIwAmU1n7SPkmhIl1HlSOpvcvDfhUN5wuqU955vOBvfkBOh5A11U 1097 zBuo2WlgZ6hYi9-e3w29bR0C2-pp3jbqxEDw3iWaf2dc5b-LnR0FEYXvI_tYk5rd 1098 _J9N0mg0tQ6RbpxNEMNoA9QWk5lgdPvbh9BaO195abQ. 1099 AVO9iT5AV4CzvDJCdhSFlQ 1101 Appendix B. Relationship of JWTs to SAML Assertions 1103 SAML 2.0 [OASIS.saml-core-2.0-os] provides a standard for creating 1104 security tokens with greater expressivity and more security options 1105 than supported by JWTs. However, the cost of this flexibility and 1106 expressiveness is both size and complexity. SAML's use of XML 1107 [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] contributes to the 1108 size of SAML assertions; its use of XML and especially XML 1109 Canonicalization [W3C.REC-xml-c14n-20010315] contributes to their 1110 complexity. 1112 JWTs are intended to provide a simple security token format that is 1113 small enough to fit into HTTP headers and query arguments in URIs. 1114 It does this by supporting a much simpler token model than SAML and 1115 using the JSON [RFC7159] object encoding syntax. It also supports 1116 securing tokens using Message Authentication Codes (MACs) and digital 1117 signatures using a smaller (and less flexible) format than XML DSIG. 1119 Therefore, while JWTs can do some of the things SAML assertions do, 1120 JWTs are not intended as a full replacement for SAML assertions, but 1121 rather as a token format to be used when ease of implementation or 1122 compactness are considerations. 1124 SAML Assertions are always statements made by an entity about a 1125 subject. JWTs are often used in the same manner, with the entity 1126 making the statements being represented by the "iss" (issuer) claim, 1127 and the subject being represented by the "sub" (subject) claim. 1128 However, with these claims being optional, other uses of the JWT 1129 format are also permitted. 1131 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) 1133 Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets 1134 of claims to be communicated between applications. For SWTs, both 1135 the claim names and claim values are strings. For JWTs, while claim 1136 names are strings, claim values can be any JSON type. Both token 1137 types offer cryptographic protection of their content: SWTs with HMAC 1138 SHA-256 and JWTs with a choice of algorithms, including signature, 1139 MAC, and encryption algorithms. 1141 Appendix D. Acknowledgements 1143 The authors acknowledge that the design of JWTs was intentionally 1144 influenced by the design and simplicity of Simple Web Tokens [SWT] 1145 and ideas for JSON tokens that Dick Hardt discussed within the OpenID 1146 community. 1148 Solutions for signing JSON content were previously explored by Magic 1149 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 1150 Applications [CanvasApp], all of which influenced this draft. 1152 This specification is the work of the OAuth Working Group, which 1153 includes dozens of active and dedicated participants. In particular, 1154 the following individuals contributed ideas, feedback, and wording 1155 that influenced this specification: 1157 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 1158 Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben 1159 Laurie, James Manger, Prateek Mishra, Tony Nadalin, Axel Nennker, 1160 John Panzer, Emmanuel Raviart, David Recordon, Eric Rescorla, Jim 1161 Schaad, Paul Tarjan, Hannes Tschofenig, and Sean Turner. 1163 Hannes Tschofenig and Derek Atkins chaired the OAuth working group 1164 and Sean Turner and Stephen Farrell served as Security area directors 1165 during the creation of this specification. 1167 Appendix E. Document History 1169 [[ to be removed by the RFC Editor before publication as an RFC ]] 1171 -19 1172 o Specified that support for Nested JWTs is optional and that 1173 applications using this specification can impose additional 1174 requirements upon implementations that they use. 1176 o Updated the JSON reference to RFC 7159. 1178 -18 1180 o Clarified that the base64url encoding includes no line breaks, 1181 white space, or other additional characters. 1183 o Removed circularity in the audience claim definition. 1185 o Clarified that it is entirely up to applications which claims to 1186 use. 1188 o Changed "SHOULD" to "MUST" in "in the absence of such 1189 requirements, all claims that are not understood by 1190 implementations MUST be ignored". 1192 o Clarified that applications can define their own processing rules 1193 for claims replicated in header parameters, rather than always 1194 requiring that they be identical in the JWT Header and JWT Claims 1195 Set. 1197 o Removed a JWT creation step that duplicated a step in the 1198 underlying JWS or JWE creation. 1200 o Added security considerations about using JWTs in trust decisions. 1202 -17 1204 o Corrected RFC 2119 terminology usage. 1206 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 1208 -16 1210 o Changed some references from being normative to informative, per 1211 JOSE issue #90. 1213 -15 1215 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis. 1217 -14 1218 o Referenced the JWE section on Distinguishing between JWS and JWE 1219 Objects. 1221 -13 1223 o Added Claim Description registry field. 1225 o Used Header Parameter Description registry field. 1227 o Removed the phrases "JWA signing algorithms" and "JWA encryption 1228 algorithms". 1230 o Removed the term JSON Text Object. 1232 -12 1234 o Tracked the JOSE change refining the "typ" and "cty" definitions 1235 to always be MIME Media Types, with the omission of "application/" 1236 prefixes recommended for brevity. For compatibility with legacy 1237 implementations, it is RECOMMENDED that "JWT" always be spelled 1238 using uppercase characters when used as a "typ" or "cty" value. 1239 As side effects, this change removed the "typ" Claim definition 1240 and narrowed the uses of the URI 1241 "urn:ietf:params:oauth:token-type:jwt". 1243 o Updated base64url definition to match JOSE definition. 1245 o Changed terminology from "Reserved Claim Name" to "Registered 1246 Claim Name" to match JOSE terminology change. 1248 o Applied other editorial changes to track parallel JOSE changes. 1250 o Clarified that the subject value may be scoped to be locally 1251 unique in the context of the issuer or may be globally unique. 1253 -11 1255 o Added a Nested JWT example. 1257 o Added "sub" to the list of Claims registered for use as Header 1258 Parameter values when an unencrypted representation is required in 1259 an encrypted JWT. 1261 -10 1263 o Allowed Claims to be replicated as Header Parameters in encrypted 1264 JWTs as needed by applications that require an unencrypted 1265 representation of specific Claims. 1267 -09 1269 o Clarified that the "typ" header parameter is used in an 1270 application-specific manner and has no effect upon the JWT 1271 processing. 1273 o Stated that recipients MUST either reject JWTs with duplicate 1274 Header Parameter Names or with duplicate Claim Names or use a JSON 1275 parser that returns only the lexically last duplicate member name. 1277 -08 1279 o Tracked a change to how JWEs are computed (which only affected the 1280 example encrypted JWT value). 1282 -07 1284 o Defined that the default action for claims that are not understood 1285 is to ignore them unless otherwise specified by applications. 1287 o Changed from using the term "byte" to "octet" when referring to 8 1288 bit values. 1290 o Tracked encryption computation changes in the JWE specification. 1292 -06 1294 o Changed the name of the "prn" claim to "sub" (subject) both to 1295 more closely align with SAML name usage and to use a more 1296 intuitive name. 1298 o Allow JWTs to have multiple audiences. 1300 o Applied editorial improvements suggested by Jeff Hodges, Prateek 1301 Mishra, and Hannes Tschofenig. Many of these simplified the 1302 terminology used. 1304 o Explained why Nested JWTs should be signed and then encrypted. 1306 o Clarified statements of the form "This claim is OPTIONAL" to "Use 1307 of this claim is OPTIONAL". 1309 o Referenced String Comparison Rules in JWS. 1311 o Added seriesInfo information to Internet Draft references. 1313 -05 1314 o Updated values for example AES CBC calculations. 1316 -04 1318 o Promoted Initialization Vector from being a header parameter to 1319 being a top-level JWE element. This saves approximately 16 bytes 1320 in the compact serialization, which is a significant savings for 1321 some use cases. Promoting the Initialization Vector out of the 1322 header also avoids repeating this shared value in the JSON 1323 serialization. 1325 o Applied changes made by the RFC Editor to RFC 6749's registry 1326 language to this specification. 1328 o Reference RFC 6755 -- An IETF URN Sub-Namespace for OAuth. 1330 -03 1332 o Added statement that "StringOrURI values are compared as case- 1333 sensitive strings with no transformations or canonicalizations 1334 applied". 1336 o Indented artwork elements to better distinguish them from the body 1337 text. 1339 -02 1341 o Added an example of an encrypted JWT. 1343 o Added this language to Registration Templates: "This name is case 1344 sensitive. Names that match other registered names in a case 1345 insensitive manner SHOULD NOT be accepted." 1347 o Applied editorial suggestions. 1349 -01 1351 o Added the "cty" (content type) header parameter for declaring type 1352 information about the secured content, as opposed to the "typ" 1353 (type) header parameter, which declares type information about 1354 this object. This significantly simplified nested JWTs. 1356 o Moved description of how to determine whether a header is for a 1357 JWS or a JWE from the JWT spec to the JWE spec. 1359 o Changed registration requirements from RFC Required to 1360 Specification Required with Expert Review. 1362 o Added Registration Template sections for defined registries. 1364 o Added Registry Contents sections to populate registry values. 1366 o Added "Collision Resistant Namespace" to the terminology section. 1368 o Numerous editorial improvements. 1370 -00 1372 o Created the initial IETF draft based upon 1373 draft-jones-json-web-token-10 with no normative changes. 1375 Authors' Addresses 1377 Michael B. Jones 1378 Microsoft 1380 Email: mbj@microsoft.com 1381 URI: http://self-issued.info/ 1383 John Bradley 1384 Ping Identity 1386 Email: ve7jtb@ve7jtb.com 1387 URI: http://www.thread-safe.com/ 1389 Nat Sakimura 1390 Nomura Research Institute 1392 Email: n-sakimura@nri.co.jp 1393 URI: http://nat.sakimura.org/