idnits 2.17.1 draft-ietf-oauth-json-web-token-25.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 (July 4, 2014) is 3574 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) == Unused Reference: 'RFC4648' is defined on line 948, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'ECMAScript' ** Downref: Normative reference to an Informational RFC: RFC 6755 ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 2 errors (**), 0 flaws (~~), 2 warnings (==), 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: January 5, 2015 Ping Identity 6 N. Sakimura 7 NRI 8 July 4, 2014 10 JSON Web Token (JWT) 11 draft-ietf-oauth-json-web-token-25 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 January 5, 2015. 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. JOSE Header . . . . . . . . . . . . . . . . . . . . . . . . . 10 76 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 10 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. Header Parameter Names Registration . . . . . . . . . . . 19 95 10.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 19 97 11. Security Considerations . . . . . . . . . . . . . . . . . . . 19 98 11.1. Trust Decisions . . . . . . . . . . . . . . . . . . . . . 20 99 11.2. Signing and Encryption Order . . . . . . . . . . . . . . . 20 100 12. Privacy Considerations . . . . . . . . . . . . . . . . . . . . 20 101 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 21 102 13.1. Normative References . . . . . . . . . . . . . . . . . . . 21 103 13.2. Informative References . . . . . . . . . . . . . . . . . . 21 104 Appendix A. JWT Examples . . . . . . . . . . . . . . . . . . . . 22 105 A.1. Example Encrypted JWT . . . . . . . . . . . . . . . . . . 23 106 A.2. Example Nested JWT . . . . . . . . . . . . . . . . . . . . 23 107 Appendix B. Relationship of JWTs to SAML Assertions . . . . . . . 25 108 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) . . 26 109 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 26 110 Appendix E. Document History . . . . . . . . . . . . . . . . . . 26 111 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 32 113 1. Introduction 115 JSON Web Token (JWT) is a compact claims representation format 116 intended for space constrained environments such as HTTP 117 Authorization headers and URI query parameters. JWTs encode claims 118 to be transmitted as a JavaScript Object Notation (JSON) [RFC7159] 119 object that is used as the payload of a JSON Web Signature (JWS) 120 [JWS] structure or as the plaintext of a JSON Web Encryption (JWE) 121 [JWE] structure, enabling the claims to be digitally signed or MACed 122 and/or encrypted. JWTs are always represented using the JWS Compact 123 Serialization or the JWE Compact Serialization. 125 The suggested pronunciation of JWT is the same as the English word 126 "jot". 128 1.1. Notational Conventions 130 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 131 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 132 "OPTIONAL" in this document are to be interpreted as described in Key 133 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 134 these words are used without being spelled in uppercase then they are 135 to be interpreted with their normal natural language meanings. 137 2. Terminology 139 These terms defined by the JSON Web Signature (JWS) [JWS] 140 specification are incorporated into this specification: "JSON Web 141 Signature (JWS)", "Base64url Encoding", "Header Parameter", "JOSE 142 Header", "JWS Compact Serialization", "JWS Payload", "JWS Signature", 143 and "Plaintext JWS". 145 These terms defined by the JSON Web Encryption (JWE) [JWE] 146 specification are incorporated into this specification: "JSON Web 147 Encryption (JWE)", "Content Encryption Key (CEK)", "JWE Compact 148 Serialization", "JWE Encrypted Key", "JWE Initialization Vector", 149 "JWE Plaintext". 151 These terms are defined by this specification: 153 JSON Web Token (JWT) 154 A string representing a set of claims as a JSON object that is 155 encoded in a JWS or JWE, enabling the claims to be digitally 156 signed or MACed and/or encrypted. 158 JWT Claims Set 159 A JSON object that contains the Claims conveyed by the JWT. 161 Claim 162 A piece of information asserted about a subject. A Claim is 163 represented as a name/value pair consisting of a Claim Name and a 164 Claim Value. 166 Claim Name 167 The name portion of a Claim representation. A Claim Name is 168 always a string. 170 Claim Value 171 The value portion of a Claim representation. A Claim Value can be 172 any JSON value. 174 Encoded JOSE Header 175 Base64url encoding of the JOSE Header. 177 Nested JWT 178 A JWT in which nested signing and/or encryption are employed. In 179 nested JWTs, a JWT is used as the payload or plaintext value of an 180 enclosing JWS or JWE structure, respectively. 182 Plaintext JWT 183 A JWT whose Claims are not integrity protected or encrypted. 185 Collision-Resistant Name 186 A name in a namespace that enables names to be allocated in a 187 manner such that they are highly unlikely to collide with other 188 names. Examples of collision-resistant namespaces include: Domain 189 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 190 X.670 Recommendation series, and Universally Unique IDentifiers 191 (UUIDs) [RFC4122]. When using an administratively delegated 192 namespace, the definer of a name needs to take reasonable 193 precautions to ensure they are in control of the portion of the 194 namespace they use to define the name. 196 StringOrURI 197 A JSON string value, with the additional requirement that while 198 arbitrary string values MAY be used, any value containing a ":" 199 character MUST be a URI [RFC3986]. StringOrURI values are 200 compared as case-sensitive strings with no transformations or 201 canonicalizations applied. 203 IntDate 204 A JSON numeric value representing the number of seconds from 1970- 205 01-01T0:0:0Z UTC until the specified UTC date/time. See RFC 3339 206 [RFC3339] for details regarding date/times in general and UTC in 207 particular. 209 3. JSON Web Token (JWT) Overview 211 JWTs represent a set of claims as a JSON object that is encoded in a 212 JWS and/or JWE structure. This JSON object is the JWT Claims Set. As 213 per Section 4 of RFC 7159 [RFC7159], the JSON object consists of zero 214 or more name/value pairs (or members), where the names are strings 215 and the values are arbitrary JSON values. These members are the 216 claims represented by the JWT. 218 The member names within the JWT Claims Set are referred to as Claim 219 Names. The corresponding values are referred to as Claim Values. 221 The contents of the JOSE Header describe the cryptographic operations 222 applied to the JWT Claims Set. If the JOSE Header is for a JWS 223 object, the JWT is represented as a JWS, and the claims are digitally 224 signed or MACed, with the JWT Claims Set being the JWS Payload. If 225 the JOSE Header is for a JWE object, the JWT is represented as a JWE, 226 and the claims are encrypted, with the JWT Claims Set being the JWE 227 Plaintext. A JWT may be enclosed in another JWE or JWS structure to 228 create a Nested JWT, enabling nested signing and encryption to be 229 performed. 231 A JWT is represented as a sequence of URL-safe parts separated by 232 period ('.') characters. Each part contains a base64url encoded 233 value. The number of parts in the JWT is dependent upon the 234 representation of the resulting JWS or JWE object using the JWS 235 Compact Serialization or the JWE Compact Serialization. 237 3.1. Example JWT 239 The following example JOSE Header declares that the encoded object is 240 a JSON Web Token (JWT) and the JWT is a JWS that is MACed using the 241 HMAC SHA-256 algorithm: 243 {"typ":"JWT", 244 "alg":"HS256"} 246 To remove potential ambiguities in the representation of the JSON 247 object above, the octet sequence for the actual UTF-8 representation 248 used in this example for the JOSE Header above is also included 249 below. (Note that ambiguities can arise due to differing platform 250 representations of line breaks (CRLF versus LF), differing spacing at 251 the beginning and ends of lines, whether the last line has a 252 terminating line break or not, and other causes. In the 253 representation used in this example, the first line has no leading or 254 trailing spaces, a CRLF line break (13, 10) occurs between the first 255 and second lines, the second line has one leading space (32) and no 256 trailing spaces, and the last line does not have a terminating line 257 break.) The octets representing the UTF-8 representation of the JOSE 258 Header in this example (using JSON array notation) are: 260 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 261 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 263 Base64url encoding the octets of the UTF-8 representation of the JOSE 264 Header yields this Encoded JOSE Header value: 266 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 268 The following is an example of a JWT Claims Set: 270 {"iss":"joe", 271 "exp":1300819380, 272 "http://example.com/is_root":true} 274 The following octet sequence, which is the UTF-8 representation used 275 in this example for the JWT Claims Set above, is the JWS Payload: 277 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 278 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 279 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 280 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 281 111, 116, 34, 58, 116, 114, 117, 101, 125] 283 Base64url encoding the JWS Payload yields this encoded JWS Payload 284 (with line breaks for display purposes only): 286 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly 287 9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ 289 Computing the MAC of the encoded JOSE Header and encoded JWS Payload 290 with the HMAC SHA-256 algorithm and base64url encoding the HMAC value 291 in the manner specified in [JWS], yields this encoded JWS Signature: 293 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 295 Concatenating these encoded parts in this order with period ('.') 296 characters between the parts yields this complete JWT (with line 297 breaks for display purposes only): 299 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 300 . 301 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 302 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 303 . 304 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 306 This computation is illustrated in more detail in Appendix A.1 of 307 [JWS]. See Appendix A.1 for an example of an encrypted JWT. 309 4. JWT Claims 311 The JWT Claims Set represents a JSON object whose members are the 312 claims conveyed by the JWT. The Claim Names within a JWT Claims Set 313 MUST be unique; recipients MUST either reject JWTs with duplicate 314 Claim Names or use a JSON parser that returns only the lexically last 315 duplicate member name, as specified in Section 15.12 (The JSON 316 Object) of ECMAScript 5.1 [ECMAScript]. 318 The set of claims that a JWT must contain to be considered valid is 319 context-dependent and is outside the scope of this specification. 320 Specific applications of JWTs will require implementations to 321 understand and process some claims in particular ways. However, in 322 the absence of such requirements, all claims that are not understood 323 by implementations MUST be ignored. 325 There are three classes of JWT Claim Names: Registered Claim Names, 326 Public Claim Names, and Private Claim Names. 328 4.1. Registered Claim Names 330 The following Claim Names are registered in the IANA JSON Web Token 331 Claims registry defined in Section 10.1. None of the claims defined 332 below are intended to be mandatory to use or implement in all cases, 333 but rather, provide a starting point for a set of useful, 334 interoperable claims. Applications using JWTs should define which 335 specific claims they use and when they are required or optional. All 336 the names are short because a core goal of JWTs is for the 337 representation to be compact. 339 4.1.1. "iss" (Issuer) Claim 341 The "iss" (issuer) claim identifies the principal that issued the 342 JWT. The processing of this claim is generally application specific. 343 The "iss" value is a case-sensitive string containing a StringOrURI 344 value. Use of this claim is OPTIONAL. 346 4.1.2. "sub" (Subject) Claim 348 The "sub" (subject) claim identifies the principal that is the 349 subject of the JWT. The Claims in a JWT are normally statements 350 about the subject. The subject value MAY be scoped to be locally 351 unique in the context of the issuer or MAY be globally unique. The 352 processing of this claim is generally application specific. The 353 "sub" value is a case-sensitive string containing a StringOrURI 354 value. Use of this claim is OPTIONAL. 356 4.1.3. "aud" (Audience) Claim 358 The "aud" (audience) claim identifies the recipients that the JWT is 359 intended for. Each principal intended to process the JWT MUST 360 identify itself with a value in the audience claim. If the principal 361 processing the claim does not identify itself with a value in the 362 "aud" claim when this claim is present, then the JWT MUST be 363 rejected. In the general case, the "aud" value is an array of case- 364 sensitive strings, each containing a StringOrURI value. In the 365 special case when the JWT has one audience, the "aud" value MAY be a 366 single case-sensitive string containing a StringOrURI value. The 367 interpretation of audience values is generally application specific. 368 Use of this claim is OPTIONAL. 370 4.1.4. "exp" (Expiration Time) Claim 372 The "exp" (expiration time) claim identifies the expiration time on 373 or after which the JWT MUST NOT be accepted for processing. The 374 processing of the "exp" claim requires that the current date/time 375 MUST be before the expiration date/time listed in the "exp" claim. 376 Implementers MAY provide for some small leeway, usually no more than 377 a few minutes, to account for clock skew. Its value MUST be a number 378 containing an IntDate value. Use of this claim is OPTIONAL. 380 4.1.5. "nbf" (Not Before) Claim 382 The "nbf" (not before) claim identifies the time before which the JWT 383 MUST NOT be accepted for processing. The processing of the "nbf" 384 claim requires that the current date/time MUST be after or equal to 385 the not-before date/time listed in the "nbf" claim. Implementers MAY 386 provide for some small leeway, usually no more than a few minutes, to 387 account for clock skew. Its value MUST be a number containing an 388 IntDate value. Use of this claim is OPTIONAL. 390 4.1.6. "iat" (Issued At) Claim 392 The "iat" (issued at) claim identifies the time at which the JWT was 393 issued. This claim can be used to determine the age of the JWT. Its 394 value MUST be a number containing an IntDate value. Use of this 395 claim is OPTIONAL. 397 4.1.7. "jti" (JWT ID) Claim 399 The "jti" (JWT ID) claim provides a unique identifier for the JWT. 400 The identifier value MUST be assigned in a manner that ensures that 401 there is a negligible probability that the same value will be 402 accidentally assigned to a different data object. The "jti" claim 403 can be used to prevent the JWT from being replayed. The "jti" value 404 is a case-sensitive string. Use of this claim is OPTIONAL. 406 4.2. Public Claim Names 408 Claim Names can be defined at will by those using JWTs. However, in 409 order to prevent collisions, any new Claim Name should either be 410 registered in the IANA JSON Web Token Claims registry defined in 411 Section 10.1 or be a Public Name: a value that contains a Collision- 412 Resistant Name. In each case, the definer of the name or value needs 413 to take reasonable precautions to make sure they are in control of 414 the part of the namespace they use to define the Claim Name. 416 4.3. Private Claim Names 418 A producer and consumer of a JWT MAY agree to use Claim Names that 419 are Private Names: names that are not Registered Claim Names 420 Section 4.1 or Public Claim Names Section 4.2. Unlike Public Claim 421 Names, Private Claim Names are subject to collision and should be 422 used with caution. 424 5. JOSE Header 426 For a JWT object, the members of the JSON object represented by the 427 JOSE Header describe the cryptographic operations applied to the JWT 428 and optionally, additional properties of the JWT. Depending upon 429 whether the JWT is a JWS or JWE, the corresponding rules for the JOSE 430 Header values apply. 432 This specification further specifies the use of the following Header 433 Parameters in both the cases where the JWT is a JWS and where it is a 434 JWE. 436 5.1. "typ" (Type) Header Parameter 438 The "typ" (type) Header Parameter defined by [JWS] and [JWE] is used 439 by JWT applications to declare the MIME Media Type [IANA.MediaTypes] 440 of this complete JWT. This is intended for use by the JWT 441 application when values that are not JWTs could also be present in an 442 application data structure that can contain a JWT object; the 443 application can use this value to disambiguate among the different 444 kinds of objects that might be present. It will typically not be 445 used by applications when it is already known that the object is a 446 JWT. This parameter is ignored by JWT implementations; any 447 processing of this parameter is performed by the JWT application. If 448 present, it is RECOMMENDED that its value be "JWT" to indicate that 449 this object is a JWT. While media type names are not case-sensitive, 450 it is RECOMMENDED that "JWT" always be spelled using uppercase 451 characters for compatibility with legacy implementations. Use of 452 this Header Parameter is OPTIONAL. 454 5.2. "cty" (Content Type) Header Parameter 456 The "cty" (content type) Header Parameter defined by [JWS] and [JWE] 457 is used by this specification to convey structural information about 458 the JWT. 460 In the normal case where nested signing or encryption operations are 461 not employed, the use of this Header Parameter is NOT RECOMMENDED. 462 In the case that nested signing or encryption is employed, this 463 Header Parameter MUST be present; in this case, the value MUST be 464 "JWT", to indicate that a Nested JWT is carried in this JWT. While 465 media type names are not case-sensitive, it is RECOMMENDED that "JWT" 466 always be spelled using uppercase characters for compatibility with 467 legacy implementations. See Appendix A.2 for an example of a Nested 468 JWT. 470 5.3. Replicating Claims as Header Parameters 472 In some applications using encrypted JWTs, it is useful to have an 473 unencrypted representation of some Claims. This might be used, for 474 instance, in application processing rules to determine whether and 475 how to process the JWT before it is decrypted. 477 This specification allows Claims present in the JWT Claims Set to be 478 replicated as Header Parameters in a JWT that is a JWE, as needed by 479 the application. If such replicated Claims are present, the 480 application receiving them SHOULD verify that their values are 481 identical, unless the application defines other specific processing 482 rules for these Claims. It is the responsibility of the application 483 to ensure that only claims that are safe to be transmitted in an 484 unencrypted manner are replicated as Header Parameter values in the 485 JWT. 487 Section 10.4.1 of this specification registers the "iss" (issuer), 488 "sub" (subject), and "aud" (audience) Header Parameter names for the 489 purpose of providing unencrypted replicas of these Claims in 490 encrypted JWTs for applications that need them. Other specifications 491 MAY similarly register other names that are registered Claim Names as 492 Header Parameter names, as needed. 494 6. Plaintext JWTs 496 To support use cases where the JWT content is secured by a means 497 other than a signature and/or encryption contained within the JWT 498 (such as a signature on a data structure containing the JWT), JWTs 499 MAY also be created without a signature or encryption. A plaintext 500 JWT is a JWS using the "alg" Header Parameter value "none" and with 501 the empty string for its JWS Signature value, as defined in JSON Web 502 Algorithms (JWA) [JWA]; it is a Plaintext JWS with the JWT Claims Set 503 as its JWS Payload. 505 6.1. Example Plaintext JWT 507 The following example JOSE Header declares that the encoded object is 508 a Plaintext JWT: 510 {"alg":"none"} 512 Base64url encoding the octets of the UTF-8 representation of the JOSE 513 Header yields this Encoded JOSE Header: 515 eyJhbGciOiJub25lIn0 517 The following is an example of a JWT Claims Set: 519 {"iss":"joe", 520 "exp":1300819380, 521 "http://example.com/is_root":true} 523 Base64url encoding the octets of the UTF-8 representation of the JWT 524 Claims Set yields this encoded JWS Payload (with line breaks for 525 display purposes only): 527 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 528 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 530 The encoded JWS Signature is the empty string. 532 Concatenating these encoded parts in this order with period ('.') 533 characters between the parts yields this complete JWT (with line 534 breaks for display purposes only): 536 eyJhbGciOiJub25lIn0 537 . 538 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 539 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 540 . 542 7. Rules for Creating and Validating a JWT 544 To create a JWT, the following steps MUST be taken. The order of the 545 steps is not significant in cases where there are no dependencies 546 between the inputs and outputs of the steps. 548 1. Create a JWT Claims Set containing the desired claims. Note that 549 white space is explicitly allowed in the representation and no 550 canonicalization need be performed before encoding. 552 2. Let the Message be the octets of the UTF-8 representation of the 553 JWT Claims Set. 555 3. Create a JOSE Header containing the desired set of Header 556 Parameters. The JWT MUST conform to either the [JWS] or [JWE] 557 specifications. Note that white space is explicitly allowed in 558 the representation and no canonicalization need be performed 559 before encoding. 561 4. Depending upon whether the JWT is a JWS or JWE, there are two 562 cases: 564 * If the JWT is a JWS, create a JWS using the Message as the JWS 565 Payload; all steps specified in [JWS] for creating a JWS MUST 566 be followed. 568 * Else, if the JWT is a JWE, create a JWE using the Message as 569 the JWE Plaintext; all steps specified in [JWE] for creating a 570 JWE MUST be followed. 572 5. If a nested signing or encryption operation will be performed, 573 let the Message be the JWS or JWE, and return to Step 3, using a 574 "cty" (content type) value of "JWT" in the new JOSE Header 575 created in that step. 577 6. Otherwise, let the resulting JWT be the JWS or JWE. 579 When validating a JWT, the following steps MUST be taken. The order 580 of the steps is not significant in cases where there are no 581 dependencies between the inputs and outputs of the steps. If any of 582 the listed steps fails then the JWT MUST be rejected for processing. 584 1. The JWT MUST contain at least one period ('.') character. 586 2. Let the Encoded JOSE Header be the portion of the JWT before the 587 first period ('.') character. 589 3. The Encoded JOSE Header MUST be successfully base64url decoded 590 following the restriction given in this specification that no 591 padding characters have been used. 593 4. The resulting JOSE Header MUST be completely valid JSON syntax 594 conforming to RFC 7159 [RFC7159]. 596 5. The resulting JOSE Header MUST be validated to only include 597 parameters and values whose syntax and semantics are both 598 understood and supported or that are specified as being ignored 599 when not understood. 601 6. Determine whether the JWT is a JWS or a JWE using any of the 602 methods described in Section 9 of [JWE]. 604 7. Depending upon whether the JWT is a JWS or JWE, there are two 605 cases: 607 * If the JWT is a JWS, all steps specified in [JWS] for 608 validating a JWS MUST be followed. Let the Message be the 609 result of base64url decoding the JWS Payload. 611 * Else, if the JWT is a JWE, all steps specified in [JWE] for 612 validating a JWE MUST be followed. Let the Message be the 613 JWE Plaintext. 615 8. If the JOSE Header contains a "cty" (content type) value of 616 "JWT", then the Message is a JWT that was the subject of nested 617 signing or encryption operations. In this case, return to Step 618 1, using the Message as the JWT. 620 9. Otherwise, let the JWT Claims Set be the Message. 622 10. The JWT Claims Set MUST be completely valid JSON syntax 623 conforming to RFC 7159 [RFC7159]. 625 7.1. String Comparison Rules 627 Processing a JWT inevitably requires comparing known strings to 628 values in JSON objects. For example, in checking what the algorithm 629 is, the Unicode string encoding "alg" will be checked against the 630 member names in the JOSE Header to see if there is a matching Header 631 Parameter name. 633 Comparisons between JSON strings and other Unicode strings MUST be 634 performed by comparing Unicode code points without normalization, as 635 specified in the String Comparison Rules in Section 5.3 of [JWS]. 637 8. Implementation Requirements 639 This section defines which algorithms and features of this 640 specification are mandatory to implement. Applications using this 641 specification can impose additional requirements upon implementations 642 that they use. For instance, an application might require support 643 for encrypted JWTs and Nested JWTs; another might require support for 644 signing JWTs with ECDSA using the P-256 curve and the SHA-256 hash 645 algorithm ("ES256"). 647 Of the signature and MAC algorithms specified in JSON Web Algorithms 648 (JWA) [JWA], only HMAC SHA-256 ("HS256") and "none" MUST be 649 implemented by conforming JWT implementations. It is RECOMMENDED 650 that implementations also support RSASSA-PKCS1-V1_5 with the SHA-256 651 hash algorithm ("RS256") and ECDSA using the P-256 curve and the SHA- 652 256 hash algorithm ("ES256"). Support for other algorithms and key 653 sizes is OPTIONAL. 655 Support for encrypted JWTs is OPTIONAL. If an implementation 656 provides encryption capabilities, of the encryption algorithms 657 specified in [JWA], only RSAES-PKCS1-V1_5 with 2048 bit keys 658 ("RSA1_5"), AES Key Wrap with 128 and 256 bit keys ("A128KW" and 659 "A256KW"), and the composite authenticated encryption algorithm using 660 AES CBC and HMAC SHA-2 ("A128CBC-HS256" and "A256CBC-HS512") MUST be 661 implemented by conforming implementations. It is RECOMMENDED that 662 implementations also support using ECDH-ES to agree upon a key used 663 to wrap the Content Encryption Key ("ECDH-ES+A128KW" and 664 "ECDH-ES+A256KW") and AES in Galois/Counter Mode (GCM) with 128 bit 665 and 256 bit keys ("A128GCM" and "A256GCM"). Support for other 666 algorithms and key sizes is OPTIONAL. 668 Support for Nested JWTs is OPTIONAL. 670 9. URI for Declaring that Content is a JWT 672 This specification registers the URN 673 "urn:ietf:params:oauth:token-type:jwt" for use by applications that 674 declare content types using URIs (rather than, for instance, MIME 675 Media Types) to indicate that the content referred to is a JWT. 677 10. IANA Considerations 679 10.1. JSON Web Token Claims Registry 681 This specification establishes the IANA JSON Web Token Claims 682 registry for JWT Claim Names. The registry records the Claim Name 683 and a reference to the specification that defines it. This 684 specification registers the Claim Names defined in Section 4.1. 686 Values are registered on a Specification Required [RFC5226] basis 687 after a two-week review period on the [TBD]@ietf.org mailing list, on 688 the advice of one or more Designated Experts. However, to allow for 689 the allocation of values prior to publication, the Designated 690 Expert(s) may approve registration once they are satisfied that such 691 a specification will be published. 693 Registration requests must be sent to the [TBD]@ietf.org mailing list 694 for review and comment, with an appropriate subject (e.g., "Request 695 for access token type: example"). [[ Note to the RFC Editor: The name 696 of the mailing list should be determined in consultation with the 697 IESG and IANA. Suggested name: jwt-reg-review. ]] 699 Within the review period, the Designated Expert(s) will either 700 approve or deny the registration request, communicating this decision 701 to the review list and IANA. Denials should include an explanation 702 and, if applicable, suggestions as to how to make the request 703 successful. Registration requests that are undetermined for a period 704 longer than 21 days can be brought to the IESG's attention (using the 705 iesg@iesg.org mailing list) for resolution. 707 Criteria that should be applied by the Designated Expert(s) includes 708 determining whether the proposed registration duplicates existing 709 functionality, determining whether it is likely to be of general 710 applicability or whether it is useful only for a single application, 711 and whether the registration makes sense. 713 IANA must only accept registry updates from the Designated Expert(s) 714 and should direct all requests for registration to the review mailing 715 list. 717 It is suggested that multiple Designated Experts be appointed who are 718 able to represent the perspectives of different applications using 719 this specification, in order to enable broadly-informed review of 720 registration decisions. In cases where a registration decision could 721 be perceived as creating a conflict of interest for a particular 722 Expert, that Expert should defer to the judgment of the other 723 Expert(s). 725 10.1.1. Registration Template 727 Claim Name: 728 The name requested (e.g., "example"). Because a core goal of this 729 specification is for the resulting representations to be compact, 730 it is RECOMMENDED that the name be short -- not to exceed 8 731 characters without a compelling reason to do so. This name is 732 case-sensitive. Names may not match other registered names in a 733 case-insensitive manner unless the Designated Expert(s) state that 734 there is a compelling reason to allow an exception in this 735 particular case. 737 Claim Description: 738 Brief description of the Claim (e.g., "Example description"). 740 Change Controller: 741 For Standards Track RFCs, state "IESG". For others, give the name 742 of the responsible party. Other details (e.g., postal address, 743 email address, home page URI) may also be included. 745 Specification Document(s): 746 Reference to the document(s) that specify the parameter, 747 preferably including URI(s) that can be used to retrieve copies of 748 the document(s). An indication of the relevant sections may also 749 be included but is not required. 751 10.1.2. Initial Registry Contents 753 o Claim Name: "iss" 754 o Claim Description: Issuer 755 o Change Controller: IESG 756 o Specification Document(s): Section 4.1.1 of [[ this document ]] 758 o Claim Name: "sub" 759 o Claim Description: Subject 760 o Change Controller: IESG 761 o Specification Document(s): Section 4.1.2 of [[ this document ]] 763 o Claim Name: "aud" 764 o Claim Description: Audience 765 o Change Controller: IESG 766 o Specification Document(s): Section 4.1.3 of [[ this document ]] 768 o Claim Name: "exp" 769 o Claim Description: Expiration Time 770 o Change Controller: IESG 771 o Specification Document(s): Section 4.1.4 of [[ this document ]] 773 o Claim Name: "nbf" 774 o Claim Description: Not Before 775 o Change Controller: IESG 776 o Specification Document(s): Section 4.1.5 of [[ this document ]] 778 o Claim Name: "iat" 779 o Claim Description: Issued At 780 o Change Controller: IESG 781 o Specification Document(s): Section 4.1.6 of [[ this document ]] 783 o Claim Name: "jti" 784 o Claim Description: JWT ID 785 o Change Controller: IESG 786 o Specification Document(s): Section 4.1.7 of [[ this document ]] 788 10.2. Sub-Namespace Registration of 789 urn:ietf:params:oauth:token-type:jwt 791 10.2.1. Registry Contents 793 This specification registers the value "token-type:jwt" in the IANA 794 urn:ietf:params:oauth registry established in An IETF URN Sub- 795 Namespace for OAuth [RFC6755], which can be used to indicate that the 796 content is a JWT. 798 o URN: urn:ietf:params:oauth:token-type:jwt 799 o Common Name: JSON Web Token (JWT) Token Type 800 o Change Controller: IESG 801 o Specification Document(s): [[this document]] 803 10.3. Media Type Registration 805 10.3.1. Registry Contents 807 This specification registers the "application/jwt" Media Type 808 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes], which 809 can be used to indicate that the content is a JWT. 811 o Type Name: application 812 o Subtype Name: jwt 813 o Required Parameters: n/a 814 o Optional Parameters: n/a 815 o Encoding considerations: 8bit; JWT values are encoded as a series 816 of base64url encoded values (some of which may be the empty 817 string) separated by period ('.') characters. 819 o Security Considerations: See the Security Considerations section 820 of [[ this document ]] 821 o Interoperability Considerations: n/a 822 o Published Specification: [[ this document ]] 823 o Applications that use this media type: OpenID Connect, Mozilla 824 Persona, Salesforce, Google, numerous others 825 o Additional Information: Magic number(s): n/a, File extension(s): 826 n/a, Macintosh file type code(s): n/a 827 o Person & email address to contact for further information: Michael 828 B. Jones, mbj@microsoft.com 829 o Intended Usage: COMMON 830 o Restrictions on Usage: none 831 o Author: Michael B. Jones, mbj@microsoft.com 832 o Change Controller: IESG 834 10.4. Header Parameter Names Registration 836 This specification registers specific Claim Names defined in 837 Section 4.1 in the IANA JSON Web Signature and Encryption Header 838 Parameters registry defined in [JWS] for use by Claims replicated as 839 Header Parameters in JWE objects, per Section 5.3. 841 10.4.1. Registry Contents 843 o Header Parameter Name: "iss" 844 o Header Parameter Description: Issuer 845 o Header Parameter Usage Location(s): JWE 846 o Change Controller: IESG 847 o Specification Document(s): Section 4.1.1 of [[ this document ]] 849 o Header Parameter Name: "sub" 850 o Header Parameter Description: Subject 851 o Header Parameter Usage Location(s): JWE 852 o Change Controller: IESG 853 o Specification Document(s): Section 4.1.2 of [[ this document ]] 855 o Header Parameter Name: "aud" 856 o Header Parameter Description: Audience 857 o Header Parameter Usage Location(s): JWE 858 o Change Controller: IESG 859 o Specification Document(s): Section 4.1.3 of [[ this document ]] 861 11. Security Considerations 863 All of the security issues that are pertinent to any cryptographic 864 application must be addressed by JWT/JWS/JWE/JWK agents. Among these 865 issues are protecting the user's asymmetric private and symmetric 866 secret keys, preventing various attacks, and helping avoid mistakes 867 such as inadvertently encrypting a message to the wrong recipient. 868 The entire list of security considerations is beyond the scope of 869 this document, but some significant considerations are listed here. 871 All the security considerations in the JWS specification also apply 872 to JWT, as do the JWE security considerations when encryption is 873 employed. In particular, the JWS JSON Security Considerations and 874 Unicode Comparison Security Considerations apply equally to the JWT 875 Claims Set in the same manner that they do to the JOSE Header. 877 11.1. Trust Decisions 879 The contents of a JWT cannot be relied upon in a trust decision 880 unless its contents have been cryptographically secured and bound to 881 the context necessary for the trust decision. In particular, the 882 key(s) used to sign and/or encrypt the JWT will typically need to 883 verifiably be under the control of the party identified as the issuer 884 of the JWT. 886 11.2. Signing and Encryption Order 888 While syntactically, the signing and encryption operations for Nested 889 JWTs may be applied in any order, normally senders should sign the 890 message and then encrypt the result (thus encrypting the signature). 891 This prevents attacks in which the signature is stripped, leaving 892 just an encrypted message, as well as providing privacy for the 893 signer. Furthermore, signatures over encrypted text are not 894 considered valid in many jurisdictions. 896 Note that potential concerns about security issues related to the 897 order of signing and encryption operations are already addressed by 898 the underlying JWS and JWE specifications; in particular, because JWE 899 only supports the use of authenticated encryption algorithms, 900 cryptographic concerns about the potential need to sign after 901 encryption that apply in many contexts do not apply to this 902 specification. 904 12. Privacy Considerations 906 A JWT may contain privacy-sensitive information. When this is the 907 case, measures must be taken to prevent disclosure of this 908 information to unintended parties. One way to achieve this is to use 909 an encrypted JWT. Another way is to ensure that JWTs containing 910 unencrypted privacy-sensitive information are only transmitted over 911 encrypted channels or protocols, such as TLS. 913 13. References 915 13.1. Normative References 917 [ECMAScript] 918 Ecma International, "ECMAScript Language Specification, 919 5.1 Edition", ECMA 262, June 2011. 921 [IANA.MediaTypes] 922 Internet Assigned Numbers Authority (IANA), "MIME Media 923 Types", 2005. 925 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 926 draft-ietf-jose-json-web-algorithms (work in progress), 927 July 2014. 929 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 930 draft-ietf-jose-json-web-encryption (work in progress), 931 July 2014. 933 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 934 Signature (JWS)", draft-ietf-jose-json-web-signature (work 935 in progress), July 2014. 937 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 938 Extensions (MIME) Part Two: Media Types", RFC 2046, 939 November 1996. 941 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 942 Requirement Levels", BCP 14, RFC 2119, March 1997. 944 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 945 Resource Identifier (URI): Generic Syntax", STD 66, 946 RFC 3986, January 2005. 948 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 949 Encodings", RFC 4648, October 2006. 951 [RFC6755] Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace 952 for OAuth", RFC 6755, October 2012. 954 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 955 Interchange Format", RFC 7159, March 2014. 957 13.2. Informative References 959 [CanvasApp] 960 Facebook, "Canvas Applications", 2010. 962 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 963 September 2010. 965 [MagicSignatures] 966 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 967 Signatures", January 2011. 969 [OASIS.saml-core-2.0-os] 970 Cantor, S., Kemp, J., Philpott, R., and E. Maler, 971 "Assertions and Protocol for the OASIS Security Assertion 972 Markup Language (SAML) V2.0", OASIS Standard saml-core- 973 2.0-os, March 2005. 975 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 976 Language) XML-Signature Syntax and Processing", RFC 3275, 977 March 2002. 979 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 980 Internet: Timestamps", RFC 3339, July 2002. 982 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 983 Unique IDentifier (UUID) URN Namespace", RFC 4122, 984 July 2005. 986 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 987 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 988 May 2008. 990 [SWT] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", 991 Version 0.9.5.1, November 2009. 993 [W3C.CR-xml11-20021015] 994 Cowan, J., "Extensible Markup Language (XML) 1.1", W3C 995 CR CR-xml11-20021015, October 2002. 997 [W3C.REC-xml-c14n-20010315] 998 Boyer, J., "Canonical XML Version 1.0", World Wide Web 999 Consortium Recommendation REC-xml-c14n-20010315, 1000 March 2001, 1001 . 1003 Appendix A. JWT Examples 1005 This section contains examples of JWTs. For other example JWTs, see 1006 Section 6.1 and Appendices A.1, A.2, and A.3 of [JWS]. 1008 A.1. Example Encrypted JWT 1010 This example encrypts the same claims as used in Section 3.1 to the 1011 recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 1013 The following example JOSE Header declares that: 1015 o the Content Encryption Key is encrypted to the recipient using the 1016 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and 1018 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 1019 algorithm to produce the JWE Ciphertext. 1021 {"alg":"RSA1_5","enc":"A128CBC-HS256"} 1023 Other than using the octets of the UTF-8 representation of the JWT 1024 Claims Set from Section 3.1 as the plaintext value, the computation 1025 of this JWT is identical to the computation of the JWE in Appendix 1026 A.2 of [JWE], including the keys used. 1028 The final result in this example (with line breaks for display 1029 purposes only) is: 1031 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. 1032 QR1Owv2ug2WyPBnbQrRARTeEk9kDO2w8qDcjiHnSJflSdv1iNqhWXaKH4MqAkQtM 1033 oNfABIPJaZm0HaA415sv3aeuBWnD8J-Ui7Ah6cWafs3ZwwFKDFUUsWHSK-IPKxLG 1034 TkND09XyjORj_CHAgOPJ-Sd8ONQRnJvWn_hXV1BNMHzUjPyYwEsRhDhzjAD26ima 1035 sOTsgruobpYGoQcXUwFDn7moXPRfDE8-NoQX7N7ZYMmpUDkR-Cx9obNGwJQ3nM52 1036 YCitxoQVPzjbl7WBuB7AohdBoZOdZ24WlN1lVIeh8v1K4krB8xgKvRU8kgFrEn_a 1037 1rZgN5TiysnmzTROF869lQ. 1038 AxY8DCtDaGlsbGljb3RoZQ. 1039 MKOle7UQrG6nSxTLX6Mqwt0orbHvAKeWnDYvpIAeZ72deHxz3roJDXQyhxx0wKaM 1040 HDjUEOKIwrtkHthpqEanSBNYHZgmNOV7sln1Eu9g3J8. 1041 fiK51VwhsxJ-siBMR-YFiA 1043 A.2. Example Nested JWT 1045 This example shows how a JWT can be used as the payload of a JWE or 1046 JWS to create a Nested JWT. In this case, the JWT Claims Set is 1047 first signed, and then encrypted. 1049 The inner signed JWT is identical to the example in Appendix A.2 of 1050 [JWS]. Therefore, its computation is not repeated here. This 1051 example then encrypts this inner JWT to the recipient using RSAES- 1052 PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 1054 The following example JOSE Header declares that: 1056 o the Content Encryption Key is encrypted to the recipient using the 1057 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key, 1059 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 1060 algorithm to produce the JWE Ciphertext, and 1062 o the Plaintext is itself a JWT. 1064 {"alg":"RSA1_5","enc":"A128CBC-HS256","cty":"JWT"} 1066 Base64url encoding the octets of the UTF-8 representation of the JOSE 1067 Header yields this encoded JOSE Header value: 1069 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldUIn0 1071 The computation of this JWT is identical to the computation of the 1072 JWE in Appendix A.2 of [JWE], other than that different JOSE Header, 1073 Plaintext, JWE Initialization Vector, and Content Encryption Key 1074 values are used. (The RSA key used is the same.) 1076 The Payload used is the octets of the ASCII representation of the JWT 1077 at the end of Appendix A.2.1 of [JWS] (with all whitespace and line 1078 breaks removed), which is a sequence of 458 octets. 1080 The JWE Initialization Vector value used (using JSON array notation) 1081 is: 1083 [82, 101, 100, 109, 111, 110, 100, 32, 87, 65, 32, 57, 56, 48, 53, 1084 50] 1086 This example uses the Content Encryption Key represented by the 1087 base64url encoded value below: 1089 GawgguFyGrWKav7AX4VKUg 1091 The final result for this Nested JWT (with line breaks for display 1092 purposes only) is: 1094 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldU 1095 In0. 1096 g_hEwksO1Ax8Qn7HoN-BVeBoa8FXe0kpyk_XdcSmxvcM5_P296JXXtoHISr_DD_M 1097 qewaQSH4dZOQHoUgKLeFly-9RI11TG-_Ge1bZFazBPwKC5lJ6OLANLMd0QSL4fYE 1098 b9ERe-epKYE3xb2jfY1AltHqBO-PM6j23Guj2yDKnFv6WO72tteVzm_2n17SBFvh 1099 DuR9a2nHTE67pe0XGBUS_TK7ecA-iVq5COeVdJR4U4VZGGlxRGPLRHvolVLEHx6D 1100 YyLpw30Ay9R6d68YCLi9FYTq3hIXPK_-dmPlOUlKvPr1GgJzRoeC9G5qCvdcHWsq 1101 JGTO_z3Wfo5zsqwkxruxwA. 1102 UmVkbW9uZCBXQSA5ODA1Mg. 1103 VwHERHPvCNcHHpTjkoigx3_ExK0Qc71RMEParpatm0X_qpg-w8kozSjfNIPPXiTB 1104 BLXR65CIPkFqz4l1Ae9w_uowKiwyi9acgVztAi-pSL8GQSXnaamh9kX1mdh3M_TT 1105 -FZGQFQsFhu0Z72gJKGdfGE-OE7hS1zuBD5oEUfk0Dmb0VzWEzpxxiSSBbBAzP10 1106 l56pPfAtrjEYw-7ygeMkwBl6Z_mLS6w6xUgKlvW6ULmkV-uLC4FUiyKECK4e3WZY 1107 Kw1bpgIqGYsw2v_grHjszJZ-_I5uM-9RA8ycX9KqPRp9gc6pXmoU_-27ATs9XCvr 1108 ZXUtK2902AUzqpeEUJYjWWxSNsS-r1TJ1I-FMJ4XyAiGrfmo9hQPcNBYxPz3GQb2 1109 8Y5CLSQfNgKSGt0A4isp1hBUXBHAndgtcslt7ZoQJaKe_nNJgNliWtWpJ_ebuOpE 1110 l8jdhehdccnRMIwAmU1n7SPkmhIl1HlSOpvcvDfhUN5wuqU955vOBvfkBOh5A11U 1111 zBuo2WlgZ6hYi9-e3w29bR0C2-pp3jbqxEDw3iWaf2dc5b-LnR0FEYXvI_tYk5rd 1112 _J9N0mg0tQ6RbpxNEMNoA9QWk5lgdPvbh9BaO195abQ. 1113 AVO9iT5AV4CzvDJCdhSFlQ 1115 Appendix B. Relationship of JWTs to SAML Assertions 1117 SAML 2.0 [OASIS.saml-core-2.0-os] provides a standard for creating 1118 security tokens with greater expressivity and more security options 1119 than supported by JWTs. However, the cost of this flexibility and 1120 expressiveness is both size and complexity. SAML's use of XML 1121 [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] contributes to the 1122 size of SAML assertions; its use of XML and especially XML 1123 Canonicalization [W3C.REC-xml-c14n-20010315] contributes to their 1124 complexity. 1126 JWTs are intended to provide a simple security token format that is 1127 small enough to fit into HTTP headers and query arguments in URIs. 1128 It does this by supporting a much simpler token model than SAML and 1129 using the JSON [RFC7159] object encoding syntax. It also supports 1130 securing tokens using Message Authentication Codes (MACs) and digital 1131 signatures using a smaller (and less flexible) format than XML DSIG. 1133 Therefore, while JWTs can do some of the things SAML assertions do, 1134 JWTs are not intended as a full replacement for SAML assertions, but 1135 rather as a token format to be used when ease of implementation or 1136 compactness are considerations. 1138 SAML Assertions are always statements made by an entity about a 1139 subject. JWTs are often used in the same manner, with the entity 1140 making the statements being represented by the "iss" (issuer) claim, 1141 and the subject being represented by the "sub" (subject) claim. 1142 However, with these claims being optional, other uses of the JWT 1143 format are also permitted. 1145 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) 1147 Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets 1148 of claims to be communicated between applications. For SWTs, both 1149 the claim names and claim values are strings. For JWTs, while claim 1150 names are strings, claim values can be any JSON type. Both token 1151 types offer cryptographic protection of their content: SWTs with HMAC 1152 SHA-256 and JWTs with a choice of algorithms, including signature, 1153 MAC, and encryption algorithms. 1155 Appendix D. Acknowledgements 1157 The authors acknowledge that the design of JWTs was intentionally 1158 influenced by the design and simplicity of Simple Web Tokens [SWT] 1159 and ideas for JSON tokens that Dick Hardt discussed within the OpenID 1160 community. 1162 Solutions for signing JSON content were previously explored by Magic 1163 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 1164 Applications [CanvasApp], all of which influenced this draft. 1166 This specification is the work of the OAuth Working Group, which 1167 includes dozens of active and dedicated participants. In particular, 1168 the following individuals contributed ideas, feedback, and wording 1169 that influenced this specification: 1171 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 1172 Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben 1173 Laurie, James Manger, Prateek Mishra, Kathleen Moriarty, Tony 1174 Nadalin, Axel Nennker, John Panzer, Emmanuel Raviart, David Recordon, 1175 Eric Rescorla, Jim Schaad, Paul Tarjan, Hannes Tschofenig, and Sean 1176 Turner. 1178 Hannes Tschofenig and Derek Atkins chaired the OAuth working group 1179 and Sean Turner, Stephen Farrell, and Kathleen Moriarty served as 1180 Security area directors during the creation of this specification. 1182 Appendix E. Document History 1184 [[ to be removed by the RFC Editor before publication as an RFC ]] 1185 -25 1187 o Reworded the language about JWT implementations ignoring the "typ" 1188 parameter, explicitly saying that its processing is performed by 1189 JWT applications. 1191 o Added a Privacy Considerations section. 1193 -24 1195 o Cleaned up the reference syntax in a few places. 1197 o Applied minor wording changes to the Security Considerations 1198 section. 1200 -23 1202 o Replaced the terms JWS Header, JWE Header, and JWT Header with a 1203 single JOSE Header term defined in the JWS specification. This 1204 also enabled a single Header Parameter definition to be used and 1205 reduced other areas of duplication between specifications. 1207 -22 1209 o Revised the introduction to the Security Considerations section. 1210 Also introduced subsection headings for security considerations 1211 items. 1213 o Added text about when applications typically would and would not 1214 use the "typ" header parameter. 1216 -21 1218 o Removed unnecessary informative JWK spec reference. 1220 -20 1222 o Changed the RFC 6755 reference to be normative. 1224 o Changed the JWK reference to be informative. 1226 o Described potential sources of ambiguity in representing the JSON 1227 objects used in the examples. The octets of the actual UTF-8 1228 representations of the JSON objects used in the examples are 1229 included to remove these ambiguities. 1231 o Noted that octet sequences are depicted using JSON array notation. 1233 -19 1235 o Specified that support for Nested JWTs is optional and that 1236 applications using this specification can impose additional 1237 requirements upon implementations that they use. 1239 o Updated the JSON reference to RFC 7159. 1241 -18 1243 o Clarified that the base64url encoding includes no line breaks, 1244 white space, or other additional characters. 1246 o Removed circularity in the audience claim definition. 1248 o Clarified that it is entirely up to applications which claims to 1249 use. 1251 o Changed "SHOULD" to "MUST" in "in the absence of such 1252 requirements, all claims that are not understood by 1253 implementations MUST be ignored". 1255 o Clarified that applications can define their own processing rules 1256 for claims replicated in header parameters, rather than always 1257 requiring that they be identical in the JWT Header and JWT Claims 1258 Set. 1260 o Removed a JWT creation step that duplicated a step in the 1261 underlying JWS or JWE creation. 1263 o Added security considerations about using JWTs in trust decisions. 1265 -17 1267 o Corrected RFC 2119 terminology usage. 1269 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 1271 -16 1273 o Changed some references from being normative to informative, per 1274 JOSE issue #90. 1276 -15 1278 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis. 1280 -14 1281 o Referenced the JWE section on Distinguishing between JWS and JWE 1282 Objects. 1284 -13 1286 o Added Claim Description registry field. 1288 o Used Header Parameter Description registry field. 1290 o Removed the phrases "JWA signing algorithms" and "JWA encryption 1291 algorithms". 1293 o Removed the term JSON Text Object. 1295 -12 1297 o Tracked the JOSE change refining the "typ" and "cty" definitions 1298 to always be MIME Media Types, with the omission of "application/" 1299 prefixes recommended for brevity. For compatibility with legacy 1300 implementations, it is RECOMMENDED that "JWT" always be spelled 1301 using uppercase characters when used as a "typ" or "cty" value. 1302 As side effects, this change removed the "typ" Claim definition 1303 and narrowed the uses of the URI 1304 "urn:ietf:params:oauth:token-type:jwt". 1306 o Updated base64url definition to match JOSE definition. 1308 o Changed terminology from "Reserved Claim Name" to "Registered 1309 Claim Name" to match JOSE terminology change. 1311 o Applied other editorial changes to track parallel JOSE changes. 1313 o Clarified that the subject value may be scoped to be locally 1314 unique in the context of the issuer or may be globally unique. 1316 -11 1318 o Added a Nested JWT example. 1320 o Added "sub" to the list of Claims registered for use as Header 1321 Parameter values when an unencrypted representation is required in 1322 an encrypted JWT. 1324 -10 1326 o Allowed Claims to be replicated as Header Parameters in encrypted 1327 JWTs as needed by applications that require an unencrypted 1328 representation of specific Claims. 1330 -09 1332 o Clarified that the "typ" header parameter is used in an 1333 application-specific manner and has no effect upon the JWT 1334 processing. 1336 o Stated that recipients MUST either reject JWTs with duplicate 1337 Header Parameter Names or with duplicate Claim Names or use a JSON 1338 parser that returns only the lexically last duplicate member name. 1340 -08 1342 o Tracked a change to how JWEs are computed (which only affected the 1343 example encrypted JWT value). 1345 -07 1347 o Defined that the default action for claims that are not understood 1348 is to ignore them unless otherwise specified by applications. 1350 o Changed from using the term "byte" to "octet" when referring to 8 1351 bit values. 1353 o Tracked encryption computation changes in the JWE specification. 1355 -06 1357 o Changed the name of the "prn" claim to "sub" (subject) both to 1358 more closely align with SAML name usage and to use a more 1359 intuitive name. 1361 o Allow JWTs to have multiple audiences. 1363 o Applied editorial improvements suggested by Jeff Hodges, Prateek 1364 Mishra, and Hannes Tschofenig. Many of these simplified the 1365 terminology used. 1367 o Explained why Nested JWTs should be signed and then encrypted. 1369 o Clarified statements of the form "This claim is OPTIONAL" to "Use 1370 of this claim is OPTIONAL". 1372 o Referenced String Comparison Rules in JWS. 1374 o Added seriesInfo information to Internet Draft references. 1376 -05 1377 o Updated values for example AES CBC calculations. 1379 -04 1381 o Promoted Initialization Vector from being a header parameter to 1382 being a top-level JWE element. This saves approximately 16 bytes 1383 in the compact serialization, which is a significant savings for 1384 some use cases. Promoting the Initialization Vector out of the 1385 header also avoids repeating this shared value in the JSON 1386 serialization. 1388 o Applied changes made by the RFC Editor to RFC 6749's registry 1389 language to this specification. 1391 o Reference RFC 6755 -- An IETF URN Sub-Namespace for OAuth. 1393 -03 1395 o Added statement that "StringOrURI values are compared as case- 1396 sensitive strings with no transformations or canonicalizations 1397 applied". 1399 o Indented artwork elements to better distinguish them from the body 1400 text. 1402 -02 1404 o Added an example of an encrypted JWT. 1406 o Added this language to Registration Templates: "This name is case 1407 sensitive. Names that match other registered names in a case 1408 insensitive manner SHOULD NOT be accepted." 1410 o Applied editorial suggestions. 1412 -01 1414 o Added the "cty" (content type) header parameter for declaring type 1415 information about the secured content, as opposed to the "typ" 1416 (type) header parameter, which declares type information about 1417 this object. This significantly simplified nested JWTs. 1419 o Moved description of how to determine whether a header is for a 1420 JWS or a JWE from the JWT spec to the JWE spec. 1422 o Changed registration requirements from RFC Required to 1423 Specification Required with Expert Review. 1425 o Added Registration Template sections for defined registries. 1427 o Added Registry Contents sections to populate registry values. 1429 o Added "Collision Resistant Namespace" to the terminology section. 1431 o Numerous editorial improvements. 1433 -00 1435 o Created the initial IETF draft based upon 1436 draft-jones-json-web-token-10 with no normative changes. 1438 Authors' Addresses 1440 Michael B. Jones 1441 Microsoft 1443 Email: mbj@microsoft.com 1444 URI: http://self-issued.info/ 1446 John Bradley 1447 Ping Identity 1449 Email: ve7jtb@ve7jtb.com 1450 URI: http://www.thread-safe.com/ 1452 Nat Sakimura 1453 Nomura Research Institute 1455 Email: n-sakimura@nri.co.jp 1456 URI: http://nat.sakimura.org/