idnits 2.17.1 draft-ietf-oauth-json-web-token-32.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 (December 9, 2014) is 3388 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' ** Downref: Normative reference to an Informational RFC: RFC 4949 ** 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 (~~), 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: June 12, 2015 Ping Identity 6 N. Sakimura 7 NRI 8 December 9, 2014 10 JSON Web Token (JWT) 11 draft-ietf-oauth-json-web-token-32 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 Status of this Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on June 12, 2015. 39 Copyright Notice 41 Copyright (c) 2014 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 57 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 58 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 59 3. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . 6 60 3.1. Example JWT . . . . . . . . . . . . . . . . . . . . . . . 6 61 4. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . . 8 62 4.1. Registered Claim Names . . . . . . . . . . . . . . . . . . 8 63 4.1.1. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . . 9 64 4.1.2. "sub" (Subject) Claim . . . . . . . . . . . . . . . . 9 65 4.1.3. "aud" (Audience) Claim . . . . . . . . . . . . . . . . 9 66 4.1.4. "exp" (Expiration Time) Claim . . . . . . . . . . . . 9 67 4.1.5. "nbf" (Not Before) Claim . . . . . . . . . . . . . . . 9 68 4.1.6. "iat" (Issued At) Claim . . . . . . . . . . . . . . . 10 69 4.1.7. "jti" (JWT ID) Claim . . . . . . . . . . . . . . . . . 10 70 4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 10 71 4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 10 72 5. JOSE Header . . . . . . . . . . . . . . . . . . . . . . . . . 10 73 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 11 74 5.2. "cty" (Content Type) Header Parameter . . . . . . . . . . 11 75 5.3. Replicating Claims as Header Parameters . . . . . . . . . 11 76 6. Unsecured JWTs . . . . . . . . . . . . . . . . . . . . . . . . 12 77 6.1. Example Unsecured JWT . . . . . . . . . . . . . . . . . . 12 78 7. Creating and Validating JWTs . . . . . . . . . . . . . . . . . 13 79 7.1. Creating a JWT . . . . . . . . . . . . . . . . . . . . . . 13 80 7.2. Validating a JWT . . . . . . . . . . . . . . . . . . . . . 14 81 7.3. String Comparison Rules . . . . . . . . . . . . . . . . . 15 82 8. Implementation Requirements . . . . . . . . . . . . . . . . . 16 83 9. URI for Declaring that Content is a JWT . . . . . . . . . . . 16 84 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 85 10.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 16 86 10.1.1. Registration Template . . . . . . . . . . . . . . . . 18 87 10.1.2. Initial Registry Contents . . . . . . . . . . . . . . 18 88 10.2. Sub-Namespace Registration of 89 urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 19 90 10.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 19 91 10.3. Media Type Registration . . . . . . . . . . . . . . . . . 19 92 10.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 19 93 10.4. Header Parameter Names Registration . . . . . . . . . . . 20 94 10.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 20 95 11. Security Considerations . . . . . . . . . . . . . . . . . . . 21 96 11.1. Trust Decisions . . . . . . . . . . . . . . . . . . . . . 21 97 11.2. Signing and Encryption Order . . . . . . . . . . . . . . . 21 98 12. Privacy Considerations . . . . . . . . . . . . . . . . . . . . 22 99 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 22 100 13.1. Normative References . . . . . . . . . . . . . . . . . . . 22 101 13.2. Informative References . . . . . . . . . . . . . . . . . . 23 102 Appendix A. JWT Examples . . . . . . . . . . . . . . . . . . . . 24 103 A.1. Example Encrypted JWT . . . . . . . . . . . . . . . . . . 24 104 A.2. Example Nested JWT . . . . . . . . . . . . . . . . . . . . 25 105 Appendix B. Relationship of JWTs to SAML Assertions . . . . . . . 26 106 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) . . 27 107 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 27 108 Appendix E. Document History . . . . . . . . . . . . . . . . . . 28 109 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 34 111 1. Introduction 113 JSON Web Token (JWT) is a compact claims representation format 114 intended for space constrained environments such as HTTP 115 Authorization headers and URI query parameters. JWTs encode claims 116 to be transmitted as a JavaScript Object Notation (JSON) [RFC7159] 117 object that is used as the payload of a JSON Web Signature (JWS) 118 [JWS] structure or as the plaintext of a JSON Web Encryption (JWE) 119 [JWE] structure, enabling the claims to be digitally signed or MACed 120 and/or encrypted. JWTs are always represented using the JWS Compact 121 Serialization or the JWE Compact Serialization. 123 The suggested pronunciation of JWT is the same as the English word 124 "jot". 126 1.1. Notational Conventions 128 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 129 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 130 "OPTIONAL" in this document are to be interpreted as described in Key 131 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 132 these words are used without being spelled in uppercase then they are 133 to be interpreted with their normal natural language meanings. 135 2. Terminology 137 These terms defined by the JSON Web Signature (JWS) [JWS] 138 specification are incorporated into this specification: "JSON Web 139 Signature (JWS)", "Base64url Encoding", "Header Parameter", "JOSE 140 Header", "JWS Compact Serialization", "JWS Payload", "JWS Signature", 141 and "Unsecured JWS". 143 These terms defined by the JSON Web Encryption (JWE) [JWE] 144 specification are incorporated into this specification: "JSON Web 145 Encryption (JWE)", "Content Encryption Key (CEK)", "JWE Compact 146 Serialization", "JWE Encrypted Key", "JWE Initialization Vector", and 147 "JWE Plaintext". 149 These terms defined by the Internet Security Glossary, Version 2 150 [RFC4949] are incorporated into this specification: "Ciphertext", 151 "Digital Signature" "Message Authentication Code (MAC)", and 152 "Plaintext". 154 These terms are defined by this specification: 156 JSON Web Token (JWT) 157 A string representing a set of claims as a JSON object that is 158 encoded in a JWS or JWE, enabling the claims to be digitally 159 signed or MACed and/or encrypted. 161 JWT Claims Set 162 A JSON object that contains the Claims conveyed by the JWT. 164 Claim 165 A piece of information asserted about a subject. A Claim is 166 represented as a name/value pair consisting of a Claim Name and a 167 Claim Value. 169 Claim Name 170 The name portion of a Claim representation. A Claim Name is 171 always a string. 173 Claim Value 174 The value portion of a Claim representation. A Claim Value can be 175 any JSON value. 177 Encoded JOSE Header 178 Base64url encoding of the JOSE Header. 180 Nested JWT 181 A JWT in which nested signing and/or encryption are employed. In 182 nested JWTs, a JWT is used as the payload or plaintext value of an 183 enclosing JWS or JWE structure, respectively. 185 Unsecured JWT 186 A JWT whose Claims are not integrity protected or encrypted. 188 Collision-Resistant Name 189 A name in a namespace that enables names to be allocated in a 190 manner such that they are highly unlikely to collide with other 191 names. Examples of collision-resistant namespaces include: Domain 192 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 193 X.670 Recommendation series, and Universally Unique IDentifiers 194 (UUIDs) [RFC4122]. When using an administratively delegated 195 namespace, the definer of a name needs to take reasonable 196 precautions to ensure they are in control of the portion of the 197 namespace they use to define the name. 199 StringOrURI 200 A JSON string value, with the additional requirement that while 201 arbitrary string values MAY be used, any value containing a ":" 202 character MUST be a URI [RFC3986]. StringOrURI values are 203 compared as case-sensitive strings with no transformations or 204 canonicalizations applied. 206 NumericDate 207 A JSON numeric value representing the number of seconds from 1970- 208 01-01T00:00:00Z UTC until the specified UTC date/time, ignoring 209 leap seconds. This is equivalent to the IEEE Std 1003.1, 2013 210 Edition [POSIX.1] definition "Seconds Since the Epoch", in which 211 each day is accounted for by exactly 86400 seconds, other than 212 that non-integer values can be represented. See RFC 3339 213 [RFC3339] for details regarding date/times in general and UTC in 214 particular. 216 3. JSON Web Token (JWT) Overview 218 JWTs represent a set of claims as a JSON object that is encoded in a 219 JWS and/or JWE structure. This JSON object is the JWT Claims Set. As 220 per Section 4 of RFC 7159 [RFC7159], the JSON object consists of zero 221 or more name/value pairs (or members), where the names are strings 222 and the values are arbitrary JSON values. These members are the 223 claims represented by the JWT. This JSON object MAY contain white 224 space and/or line breaks before or after any JSON values or 225 structural characters, in accordance with Section 2 of RFC 7159 226 [RFC7159]. 228 The member names within the JWT Claims Set are referred to as Claim 229 Names. The corresponding values are referred to as Claim Values. 231 The contents of the JOSE Header describe the cryptographic operations 232 applied to the JWT Claims Set. If the JOSE Header is for a JWS, the 233 JWT is represented as a JWS and the claims are digitally signed or 234 MACed, with the JWT Claims Set being the JWS Payload. If the JOSE 235 Header is for a JWE, the JWT is represented as a JWE and the claims 236 are encrypted, with the JWT Claims Set being the JWE Plaintext. A 237 JWT may be enclosed in another JWE or JWS structure to create a 238 Nested JWT, enabling nested signing and encryption to be performed. 240 A JWT is represented as a sequence of URL-safe parts separated by 241 period ('.') characters. Each part contains a base64url encoded 242 value. The number of parts in the JWT is dependent upon the 243 representation of the resulting JWS using the JWS Compact 244 Serialization or JWE using the JWE Compact Serialization. 246 3.1. Example JWT 248 The following example JOSE Header declares that the encoded object is 249 a JSON Web Token (JWT) and the JWT is a JWS that is MACed using the 250 HMAC SHA-256 algorithm: 252 {"typ":"JWT", 253 "alg":"HS256"} 255 To remove potential ambiguities in the representation of the JSON 256 object above, the octet sequence for the actual UTF-8 representation 257 used in this example for the JOSE Header above is also included 258 below. (Note that ambiguities can arise due to differing platform 259 representations of line breaks (CRLF versus LF), differing spacing at 260 the beginning and ends of lines, whether the last line has a 261 terminating line break or not, and other causes. In the 262 representation used in this example, the first line has no leading or 263 trailing spaces, a CRLF line break (13, 10) occurs between the first 264 and second lines, the second line has one leading space (32) and no 265 trailing spaces, and the last line does not have a terminating line 266 break.) The octets representing the UTF-8 representation of the JOSE 267 Header in this example (using JSON array notation) are: 269 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 270 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 272 Base64url encoding the octets of the UTF-8 representation of the JOSE 273 Header yields this Encoded JOSE Header value: 275 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 277 The following is an example of a JWT Claims Set: 279 {"iss":"joe", 280 "exp":1300819380, 281 "http://example.com/is_root":true} 283 The following octet sequence, which is the UTF-8 representation used 284 in this example for the JWT Claims Set above, is the JWS Payload: 286 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 287 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 288 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 289 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 290 111, 116, 34, 58, 116, 114, 117, 101, 125] 292 Base64url encoding the JWS Payload yields this encoded JWS Payload 293 (with line breaks for display purposes only): 295 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly 296 9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ 298 Computing the MAC of the encoded JOSE Header and encoded JWS Payload 299 with the HMAC SHA-256 algorithm and base64url encoding the HMAC value 300 in the manner specified in [JWS], yields this encoded JWS Signature: 302 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 304 Concatenating these encoded parts in this order with period ('.') 305 characters between the parts yields this complete JWT (with line 306 breaks for display purposes only): 308 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 309 . 310 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 311 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 312 . 313 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 315 This computation is illustrated in more detail in Appendix A.1 of 316 [JWS]. See Appendix A.1 for an example of an encrypted JWT. 318 4. JWT Claims 320 The JWT Claims Set represents a JSON object whose members are the 321 claims conveyed by the JWT. The Claim Names within a JWT Claims Set 322 MUST be unique; JWT parsers MUST either reject JWTs with duplicate 323 Claim Names or use a JSON parser that returns only the lexically last 324 duplicate member name, as specified in Section 15.12 (The JSON 325 Object) of ECMAScript 5.1 [ECMAScript]. 327 The set of claims that a JWT must contain to be considered valid is 328 context-dependent and is outside the scope of this specification. 329 Specific applications of JWTs will require implementations to 330 understand and process some claims in particular ways. However, in 331 the absence of such requirements, all claims that are not understood 332 by implementations MUST be ignored. 334 There are three classes of JWT Claim Names: Registered Claim Names, 335 Public Claim Names, and Private Claim Names. 337 4.1. Registered Claim Names 339 The following Claim Names are registered in the IANA JSON Web Token 340 Claims registry defined in Section 10.1. None of the claims defined 341 below are intended to be mandatory to use or implement in all cases, 342 but rather, provide a starting point for a set of useful, 343 interoperable claims. Applications using JWTs should define which 344 specific claims they use and when they are required or optional. All 345 the names are short because a core goal of JWTs is for the 346 representation to be compact. 348 4.1.1. "iss" (Issuer) Claim 350 The "iss" (issuer) claim identifies the principal that issued the 351 JWT. The processing of this claim is generally application specific. 352 The "iss" value is a case-sensitive string containing a StringOrURI 353 value. Use of this claim is OPTIONAL. 355 4.1.2. "sub" (Subject) Claim 357 The "sub" (subject) claim identifies the principal that is the 358 subject of the JWT. The Claims in a JWT are normally statements 359 about the subject. The subject value MUST either be scoped to be 360 locally unique in the context of the issuer or be globally unique. 361 The processing of this claim is generally application specific. The 362 "sub" value is a case-sensitive string containing a StringOrURI 363 value. Use of this claim is OPTIONAL. 365 4.1.3. "aud" (Audience) Claim 367 The "aud" (audience) claim identifies the recipients that the JWT is 368 intended for. Each principal intended to process the JWT MUST 369 identify itself with a value in the audience claim. If the principal 370 processing the claim does not identify itself with a value in the 371 "aud" claim when this claim is present, then the JWT MUST be 372 rejected. In the general case, the "aud" value is an array of case- 373 sensitive strings, each containing a StringOrURI value. In the 374 special case when the JWT has one audience, the "aud" value MAY be a 375 single case-sensitive string containing a StringOrURI value. The 376 interpretation of audience values is generally application specific. 377 Use of this claim is OPTIONAL. 379 4.1.4. "exp" (Expiration Time) Claim 381 The "exp" (expiration time) claim identifies the expiration time on 382 or after which the JWT MUST NOT be accepted for processing. The 383 processing of the "exp" claim requires that the current date/time 384 MUST be before the expiration date/time listed in the "exp" claim. 385 Implementers MAY provide for some small leeway, usually no more than 386 a few minutes, to account for clock skew. Its value MUST be a number 387 containing a NumericDate value. Use of this claim is OPTIONAL. 389 4.1.5. "nbf" (Not Before) Claim 391 The "nbf" (not before) claim identifies the time before which the JWT 392 MUST NOT be accepted for processing. The processing of the "nbf" 393 claim requires that the current date/time MUST be after or equal to 394 the not-before date/time listed in the "nbf" claim. Implementers MAY 395 provide for some small leeway, usually no more than a few minutes, to 396 account for clock skew. Its value MUST be a number containing a 397 NumericDate value. Use of this claim is OPTIONAL. 399 4.1.6. "iat" (Issued At) Claim 401 The "iat" (issued at) claim identifies the time at which the JWT was 402 issued. This claim can be used to determine the age of the JWT. Its 403 value MUST be a number containing a NumericDate value. Use of this 404 claim is OPTIONAL. 406 4.1.7. "jti" (JWT ID) Claim 408 The "jti" (JWT ID) claim provides a unique identifier for the JWT. 409 The identifier value MUST be assigned in a manner that ensures that 410 there is a negligible probability that the same value will be 411 accidentally assigned to a different data object; if the application 412 uses multiple issuers, collisions MUST be prevented among values 413 produced by different issuers as well. The "jti" claim can be used 414 to prevent the JWT from being replayed. The "jti" value is a case- 415 sensitive string. Use of this claim is OPTIONAL. 417 4.2. Public Claim Names 419 Claim Names can be defined at will by those using JWTs. However, in 420 order to prevent collisions, any new Claim Name should either be 421 registered in the IANA JSON Web Token Claims registry defined in 422 Section 10.1 or be a Public Name: a value that contains a Collision- 423 Resistant Name. In each case, the definer of the name or value needs 424 to take reasonable precautions to make sure they are in control of 425 the part of the namespace they use to define the Claim Name. 427 4.3. Private Claim Names 429 A producer and consumer of a JWT MAY agree to use Claim Names that 430 are Private Names: names that are not Registered Claim Names 431 Section 4.1 or Public Claim Names Section 4.2. Unlike Public Claim 432 Names, Private Claim Names are subject to collision and should be 433 used with caution. 435 5. JOSE Header 437 For a JWT object, the members of the JSON object represented by the 438 JOSE Header describe the cryptographic operations applied to the JWT 439 and optionally, additional properties of the JWT. Depending upon 440 whether the JWT is a JWS or JWE, the corresponding rules for the JOSE 441 Header values apply. 443 This specification further specifies the use of the following Header 444 Parameters in both the cases where the JWT is a JWS and where it is a 445 JWE. 447 5.1. "typ" (Type) Header Parameter 449 The "typ" (type) Header Parameter defined by [JWS] and [JWE] is used 450 by JWT applications to declare the MIME Media Type [IANA.MediaTypes] 451 of this complete JWT. This is intended for use by the JWT 452 application when values that are not JWTs could also be present in an 453 application data structure that can contain a JWT object; the 454 application can use this value to disambiguate among the different 455 kinds of objects that might be present. It will typically not be 456 used by applications when it is already known that the object is a 457 JWT. This parameter is ignored by JWT implementations; any 458 processing of this parameter is performed by the JWT application. If 459 present, it is RECOMMENDED that its value be "JWT" to indicate that 460 this object is a JWT. While media type names are not case-sensitive, 461 it is RECOMMENDED that "JWT" always be spelled using uppercase 462 characters for compatibility with legacy implementations. Use of 463 this Header Parameter is OPTIONAL. 465 5.2. "cty" (Content Type) Header Parameter 467 The "cty" (content type) Header Parameter defined by [JWS] and [JWE] 468 is used by this specification to convey structural information about 469 the JWT. 471 In the normal case in which nested signing or encryption operations 472 are not employed, the use of this Header Parameter is NOT 473 RECOMMENDED. In the case that nested signing or encryption is 474 employed, this Header Parameter MUST be present; in this case, the 475 value MUST be "JWT", to indicate that a Nested JWT is carried in this 476 JWT. While media type names are not case-sensitive, it is 477 RECOMMENDED that "JWT" always be spelled using uppercase characters 478 for compatibility with legacy implementations. See Appendix A.2 for 479 an example of a Nested JWT. 481 5.3. Replicating Claims as Header Parameters 483 In some applications using encrypted JWTs, it is useful to have an 484 unencrypted representation of some Claims. This might be used, for 485 instance, in application processing rules to determine whether and 486 how to process the JWT before it is decrypted. 488 This specification allows Claims present in the JWT Claims Set to be 489 replicated as Header Parameters in a JWT that is a JWE, as needed by 490 the application. If such replicated Claims are present, the 491 application receiving them SHOULD verify that their values are 492 identical, unless the application defines other specific processing 493 rules for these Claims. It is the responsibility of the application 494 to ensure that only claims that are safe to be transmitted in an 495 unencrypted manner are replicated as Header Parameter values in the 496 JWT. 498 Section 10.4.1 of this specification registers the "iss" (issuer), 499 "sub" (subject), and "aud" (audience) Header Parameter names for the 500 purpose of providing unencrypted replicas of these Claims in 501 encrypted JWTs for applications that need them. Other specifications 502 MAY similarly register other names that are registered Claim Names as 503 Header Parameter names, as needed. 505 6. Unsecured JWTs 507 To support use cases in which the JWT content is secured by a means 508 other than a signature and/or encryption contained within the JWT 509 (such as a signature on a data structure containing the JWT), JWTs 510 MAY also be created without a signature or encryption. An Unsecured 511 JWT is a JWS using the "alg" Header Parameter value "none" and with 512 the empty string for its JWS Signature value, as defined in JSON Web 513 Algorithms (JWA) [JWA]; it is an Unsecured JWS with the JWT Claims 514 Set as its JWS Payload. 516 6.1. Example Unsecured JWT 518 The following example JOSE Header declares that the encoded object is 519 an Unsecured JWT: 521 {"alg":"none"} 523 Base64url encoding the octets of the UTF-8 representation of the JOSE 524 Header yields this Encoded JOSE Header: 526 eyJhbGciOiJub25lIn0 528 The following is an example of a JWT Claims Set: 530 {"iss":"joe", 531 "exp":1300819380, 532 "http://example.com/is_root":true} 534 Base64url encoding the octets of the UTF-8 representation of the JWT 535 Claims Set yields this encoded JWS Payload (with line breaks for 536 display purposes only): 538 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 539 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 541 The encoded JWS Signature is the empty string. 543 Concatenating these encoded parts in this order with period ('.') 544 characters between the parts yields this complete JWT (with line 545 breaks for display purposes only): 547 eyJhbGciOiJub25lIn0 548 . 549 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 550 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 551 . 553 7. Creating and Validating JWTs 555 7.1. Creating a JWT 557 To create a JWT, the following steps are performed. The order of the 558 steps is not significant in cases where there are no dependencies 559 between the inputs and outputs of the steps. 561 1. Create a JWT Claims Set containing the desired claims. Note that 562 white space is explicitly allowed in the representation and no 563 canonicalization need be performed before encoding. 565 2. Let the Message be the octets of the UTF-8 representation of the 566 JWT Claims Set. 568 3. Create a JOSE Header containing the desired set of Header 569 Parameters. The JWT MUST conform to either the [JWS] or [JWE] 570 specification. Note that white space is explicitly allowed in 571 the representation and no canonicalization need be performed 572 before encoding. 574 4. Depending upon whether the JWT is a JWS or JWE, there are two 575 cases: 577 * If the JWT is a JWS, create a JWS using the Message as the JWS 578 Payload; all steps specified in [JWS] for creating a JWS MUST 579 be followed. 581 * Else, if the JWT is a JWE, create a JWE using the Message as 582 the JWE Plaintext; all steps specified in [JWE] for creating a 583 JWE MUST be followed. 585 5. If a nested signing or encryption operation will be performed, 586 let the Message be the JWS or JWE, and return to Step 3, using a 587 "cty" (content type) value of "JWT" in the new JOSE Header 588 created in that step. 590 6. Otherwise, let the resulting JWT be the JWS or JWE. 592 7.2. Validating a JWT 594 When validating a JWT, the following steps are performed. The order 595 of the steps is not significant in cases where there are no 596 dependencies between the inputs and outputs of the steps. If any of 597 the listed steps fails then the JWT MUST be rejected -- treated by 598 the application as an invalid input. 600 1. Verify that the JWT contains at least one period ('.') 601 character. 603 2. Let the Encoded JOSE Header be the portion of the JWT before the 604 first period ('.') character. 606 3. Base64url decode the Encoded JOSE Header following the 607 restriction that no line breaks, white space, or other 608 additional characters have been used. 610 4. Verify that the resulting octet sequence is a UTF-8 encoded 611 representation of a completely valid JSON object conforming to 612 RFC 7159 [RFC7159]; let the JOSE Header be this JSON object. 614 5. Verify that the resulting JOSE Header includes only parameters 615 and values whose syntax and semantics are both understood and 616 supported or that are specified as being ignored when not 617 understood. 619 6. Determine whether the JWT is a JWS or a JWE using any of the 620 methods described in Section 9 of [JWE]. 622 7. Depending upon whether the JWT is a JWS or JWE, there are two 623 cases: 625 * If the JWT is a JWS, follow the steps specified in [JWS] for 626 validating a JWS. Let the Message be the result of base64url 627 decoding the JWS Payload. 629 * Else, if the JWT is a JWE, follow the steps specified in 630 [JWE] for validating a JWE. Let the Message be the JWE 631 Plaintext. 633 8. If the JOSE Header contains a "cty" (content type) value of 634 "JWT", then the Message is a JWT that was the subject of nested 635 signing or encryption operations. In this case, return to Step 636 1, using the Message as the JWT. 638 9. Otherwise, base64url decode the Message following the 639 restriction that no line breaks, white space, or other 640 additional characters have been used. 642 10. Verify that the resulting octet sequence is a UTF-8 encoded 643 representation of a completely valid JSON object conforming to 644 RFC 7159 [RFC7159]; let the JWT Claims Set be this JSON object. 646 Finally, note that it is an application decision which algorithms may 647 be used in a given context. Even if a JWT can be successfully 648 validated, unless the algorithm(s) used in the JWT are acceptable to 649 the application, it SHOULD reject the JWT. 651 7.3. String Comparison Rules 653 Processing a JWT inevitably requires comparing known strings to 654 members and values in JSON objects. For example, in checking what 655 the algorithm is, the Unicode string encoding "alg" will be checked 656 against the member names in the JOSE Header to see if there is a 657 matching Header Parameter name. 659 The JSON rules for doing member name comparison are described in 660 Section 8.3 of RFC 7159 [RFC7159]. Since the only string comparison 661 operations that are performed are equality and inequality, the same 662 rules can be used for comparing both member names and member values 663 against known strings. 665 These comparison rules MUST be used for all JSON string comparisons 666 except in cases where the definition of the member explicitly calls 667 out that a different comparison rule is to be used for that member 668 value. In this specification, only the "typ" and "cty" member values 669 do not use these comparison rules. 671 Some applications may include case-insensitive information in a case- 672 sensitive value, such as including a DNS name as part of the "iss" 673 (issuer) claim value. In those cases, the application may need to 674 define a convention for the canonical case to use for representing 675 the case-insensitive portions, such as lowercasing them, if more than 676 one party might need to produce the same value so that they can be 677 compared. (However if all other parties consume whatever value the 678 producing party emitted verbatim without attempting to compare it to 679 an independently produced value, then the case used by the producer 680 will not matter.) 682 8. Implementation Requirements 684 This section defines which algorithms and features of this 685 specification are mandatory to implement. Applications using this 686 specification can impose additional requirements upon implementations 687 that they use. For instance, one application might require support 688 for encrypted JWTs and Nested JWTs, while another might require 689 support for signing JWTs with ECDSA using the P-256 curve and the 690 SHA-256 hash algorithm ("ES256"). 692 Of the signature and MAC algorithms specified in JSON Web Algorithms 693 (JWA) [JWA], only HMAC SHA-256 ("HS256") and "none" MUST be 694 implemented by conforming JWT implementations. It is RECOMMENDED 695 that implementations also support RSASSA-PKCS1-V1_5 with the SHA-256 696 hash algorithm ("RS256") and ECDSA using the P-256 curve and the SHA- 697 256 hash algorithm ("ES256"). Support for other algorithms and key 698 sizes is OPTIONAL. 700 Support for encrypted JWTs is OPTIONAL. If an implementation 701 provides encryption capabilities, of the encryption algorithms 702 specified in [JWA], only RSAES-PKCS1-V1_5 with 2048 bit keys 703 ("RSA1_5"), AES Key Wrap with 128 and 256 bit keys ("A128KW" and 704 "A256KW"), and the composite authenticated encryption algorithm using 705 AES CBC and HMAC SHA-2 ("A128CBC-HS256" and "A256CBC-HS512") MUST be 706 implemented by conforming implementations. It is RECOMMENDED that 707 implementations also support using ECDH-ES to agree upon a key used 708 to wrap the Content Encryption Key ("ECDH-ES+A128KW" and 709 "ECDH-ES+A256KW") and AES in Galois/Counter Mode (GCM) with 128 bit 710 and 256 bit keys ("A128GCM" and "A256GCM"). Support for other 711 algorithms and key sizes is OPTIONAL. 713 Support for Nested JWTs is OPTIONAL. 715 9. URI for Declaring that Content is a JWT 717 This specification registers the URN 718 "urn:ietf:params:oauth:token-type:jwt" for use by applications that 719 declare content types using URIs (rather than, for instance, MIME 720 Media Types) to indicate that the content referred to is a JWT. 722 10. IANA Considerations 724 10.1. JSON Web Token Claims Registry 726 This specification establishes the IANA JSON Web Token Claims 727 registry for JWT Claim Names. The registry records the Claim Name 728 and a reference to the specification that defines it. This 729 specification registers the Claim Names defined in Section 4.1. 731 Values are registered on a Specification Required [RFC5226] basis 732 after a three-week review period on the jwt-reg-review@ietf.org 733 mailing list, on the advice of one or more Designated Experts. 734 However, to allow for the allocation of values prior to publication, 735 the Designated Expert(s) may approve registration once they are 736 satisfied that such a specification will be published. 738 Registration requests must be sent to the jwt-reg-review@ietf.org 739 mailing list for review and comment, with an appropriate subject 740 (e.g., "Request to register claim: example"). 742 Within the review period, the Designated Expert(s) will either 743 approve or deny the registration request, communicating this decision 744 to the review list and IANA. Denials should include an explanation 745 and, if applicable, suggestions as to how to make the request 746 successful. Registration requests that are undetermined for a period 747 longer than 21 days can be brought to the IESG's attention (using the 748 iesg@ietf.org mailing list) for resolution. 750 Criteria that should be applied by the Designated Expert(s) includes 751 determining whether the proposed registration duplicates existing 752 functionality, determining whether it is likely to be of general 753 applicability or whether it is useful only for a single application, 754 and whether the registration description is clear. 756 IANA must only accept registry updates from the Designated Expert(s) 757 and should direct all requests for registration to the review mailing 758 list. 760 It is suggested that multiple Designated Experts be appointed who are 761 able to represent the perspectives of different applications using 762 this specification, in order to enable broadly-informed review of 763 registration decisions. In cases where a registration decision could 764 be perceived as creating a conflict of interest for a particular 765 Expert, that Expert should defer to the judgment of the other 766 Expert(s). 768 [[ Note to the RFC Editor and IANA: Pearl Liang of ICANN had 769 requested that the draft supply the following proposed registry 770 description information. 772 o Protocol Category: JSON Web Token (JWT) 774 o Registry Location: http://www.iana.org/assignments/jwt 775 o Webpage Title: (same as the protocol category) 777 o Registry Name: JSON Web Token Claims 779 ]] 781 10.1.1. Registration Template 783 Claim Name: 784 The name requested (e.g., "iss"). Because a core goal of this 785 specification is for the resulting representations to be compact, 786 it is RECOMMENDED that the name be short -- not to exceed 8 787 characters without a compelling reason to do so. This name is 788 case-sensitive. Names may not match other registered names in a 789 case-insensitive manner unless the Designated Expert(s) state that 790 there is a compelling reason to allow an exception in this 791 particular case. 793 Claim Description: 794 Brief description of the Claim (e.g., "Issuer"). 796 Change Controller: 797 For Standards Track RFCs, state "IESG". For others, give the name 798 of the responsible party. Other details (e.g., postal address, 799 email address, home page URI) may also be included. 801 Specification Document(s): 802 Reference to the document(s) that specify the parameter, 803 preferably including URI(s) that can be used to retrieve copies of 804 the document(s). An indication of the relevant sections may also 805 be included but is not required. 807 10.1.2. Initial Registry Contents 809 o Claim Name: "iss" 810 o Claim Description: Issuer 811 o Change Controller: IESG 812 o Specification Document(s): Section 4.1.1 of [[ this document ]] 814 o Claim Name: "sub" 815 o Claim Description: Subject 816 o Change Controller: IESG 817 o Specification Document(s): Section 4.1.2 of [[ this document ]] 819 o Claim Name: "aud" 820 o Claim Description: Audience 821 o Change Controller: IESG 822 o Specification Document(s): Section 4.1.3 of [[ this document ]] 824 o Claim Name: "exp" 825 o Claim Description: Expiration Time 826 o Change Controller: IESG 827 o Specification Document(s): Section 4.1.4 of [[ this document ]] 829 o Claim Name: "nbf" 830 o Claim Description: Not Before 831 o Change Controller: IESG 832 o Specification Document(s): Section 4.1.5 of [[ this document ]] 834 o Claim Name: "iat" 835 o Claim Description: Issued At 836 o Change Controller: IESG 837 o Specification Document(s): Section 4.1.6 of [[ this document ]] 839 o Claim Name: "jti" 840 o Claim Description: JWT ID 841 o Change Controller: IESG 842 o Specification Document(s): Section 4.1.7 of [[ this document ]] 844 10.2. Sub-Namespace Registration of 845 urn:ietf:params:oauth:token-type:jwt 847 10.2.1. Registry Contents 849 This specification registers the value "token-type:jwt" in the IANA 850 urn:ietf:params:oauth registry established in An IETF URN Sub- 851 Namespace for OAuth [RFC6755], which can be used to indicate that the 852 content is a JWT. 854 o URN: urn:ietf:params:oauth:token-type:jwt 855 o Common Name: JSON Web Token (JWT) Token Type 856 o Change Controller: IESG 857 o Specification Document(s): [[this document]] 859 10.3. Media Type Registration 861 10.3.1. Registry Contents 863 This specification registers the "application/jwt" Media Type 864 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes] in the 865 manner described in RFC 6838 [RFC6838], which can be used to indicate 866 that the content is a JWT. 868 o Type Name: application 869 o Subtype Name: jwt 870 o Required Parameters: n/a 871 o Optional Parameters: n/a 872 o Encoding considerations: 8bit; JWT values are encoded as a series 873 of base64url encoded values (some of which may be the empty 874 string) separated by period ('.') characters. 875 o Security Considerations: See the Security Considerations section 876 of [[ this document ]] 877 o Interoperability Considerations: n/a 878 o Published Specification: [[ this document ]] 879 o Applications that use this media type: OpenID Connect, Mozilla 880 Persona, Salesforce, Google, Android, Windows Azure, Amazon Web 881 Services, and numerous others 882 o Fragment identifier considerations: n/a 883 o Additional Information: Magic number(s): n/a, File extension(s): 884 n/a, Macintosh file type code(s): n/a 885 o Person & email address to contact for further information: Michael 886 B. Jones, mbj@microsoft.com 887 o Intended Usage: COMMON 888 o Restrictions on Usage: none 889 o Author: Michael B. Jones, mbj@microsoft.com 890 o Change Controller: IESG 891 o Provisional registration? No 893 10.4. Header Parameter Names Registration 895 This specification registers specific Claim Names defined in 896 Section 4.1 in the IANA JSON Web Signature and Encryption Header 897 Parameters registry defined in [JWS] for use by Claims replicated as 898 Header Parameters in JWEs, per Section 5.3. 900 10.4.1. Registry Contents 902 o Header Parameter Name: "iss" 903 o Header Parameter Description: Issuer 904 o Header Parameter Usage Location(s): JWE 905 o Change Controller: IESG 906 o Specification Document(s): Section 4.1.1 of [[ this document ]] 908 o Header Parameter Name: "sub" 909 o Header Parameter Description: Subject 910 o Header Parameter Usage Location(s): JWE 911 o Change Controller: IESG 912 o Specification Document(s): Section 4.1.2 of [[ this document ]] 913 o Header Parameter Name: "aud" 914 o Header Parameter Description: Audience 915 o Header Parameter Usage Location(s): JWE 916 o Change Controller: IESG 917 o Specification Document(s): Section 4.1.3 of [[ this document ]] 919 11. Security Considerations 921 All of the security issues that are pertinent to any cryptographic 922 application must be addressed by JWT/JWS/JWE/JWK agents. Among these 923 issues are protecting the user's asymmetric private and symmetric 924 secret keys and employing countermeasures to various attacks. 926 All the security considerations in the JWS specification also apply 927 to JWT, as do the JWE security considerations when encryption is 928 employed. In particular, the JWS JSON Security Considerations and 929 Unicode Comparison Security Considerations apply equally to the JWT 930 Claims Set in the same manner that they do to the JOSE Header. 932 11.1. Trust Decisions 934 The contents of a JWT cannot be relied upon in a trust decision 935 unless its contents have been cryptographically secured and bound to 936 the context necessary for the trust decision. In particular, the 937 key(s) used to sign and/or encrypt the JWT will typically need to 938 verifiably be under the control of the party identified as the issuer 939 of the JWT. 941 11.2. Signing and Encryption Order 943 While syntactically the signing and encryption operations for Nested 944 JWTs may be applied in any order, if both signing and encryption are 945 necessary, normally producers should sign the message and then 946 encrypt the result (thus encrypting the signature). This prevents 947 attacks in which the signature is stripped, leaving just an encrypted 948 message, as well as providing privacy for the signer. Furthermore, 949 signatures over encrypted text are not considered valid in many 950 jurisdictions. 952 Note that potential concerns about security issues related to the 953 order of signing and encryption operations are already addressed by 954 the underlying JWS and JWE specifications; in particular, because JWE 955 only supports the use of authenticated encryption algorithms, 956 cryptographic concerns about the potential need to sign after 957 encryption that apply in many contexts do not apply to this 958 specification. 960 12. Privacy Considerations 962 A JWT may contain privacy-sensitive information. When this is the 963 case, measures MUST be taken to prevent disclosure of this 964 information to unintended parties. One way to achieve this is to use 965 an encrypted JWT and authenticate the recipient. Another way is to 966 ensure that JWTs containing unencrypted privacy-sensitive information 967 are only transmitted using protocols utilizing encryption that 968 support endpoint authentication, such as TLS. Omitting privacy- 969 sensitive information from a JWT is the simplest way of minimizing 970 privacy issues. 972 13. References 974 13.1. Normative References 976 [ECMAScript] 977 Ecma International, "ECMAScript Language Specification, 978 5.1 Edition", ECMA 262, June 2011. 980 [IANA.MediaTypes] 981 Internet Assigned Numbers Authority (IANA), "MIME Media 982 Types", 2005. 984 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 985 draft-ietf-jose-json-web-algorithms (work in progress), 986 December 2014. 988 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 989 draft-ietf-jose-json-web-encryption (work in progress), 990 December 2014. 992 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 993 Signature (JWS)", draft-ietf-jose-json-web-signature (work 994 in progress), December 2014. 996 [RFC20] Cerf, V., "ASCII format for Network Interchange", RFC 20, 997 October 1969. 999 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1000 Extensions (MIME) Part Two: Media Types", RFC 2046, 1001 November 1996. 1003 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1004 Requirement Levels", BCP 14, RFC 2119, March 1997. 1006 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1007 Resource Identifier (URI): Generic Syntax", STD 66, 1008 RFC 3986, January 2005. 1010 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 1011 RFC 4949, August 2007. 1013 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 1014 Interchange Format", RFC 7159, March 2014. 1016 13.2. Informative References 1018 [CanvasApp] 1019 Facebook, "Canvas Applications", 2010. 1021 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 1022 September 2010. 1024 [MagicSignatures] 1025 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 1026 Signatures", January 2011. 1028 [OASIS.saml-core-2.0-os] 1029 Cantor, S., Kemp, J., Philpott, R., and E. Maler, 1030 "Assertions and Protocol for the OASIS Security Assertion 1031 Markup Language (SAML) V2.0", OASIS Standard saml-core- 1032 2.0-os, March 2005. 1034 [POSIX.1] Institute of Electrical and Electronics Engineers, "The 1035 Open Group Base Specifications Issue 7", IEEE Std 1003.1, 1036 2013 Edition, 2013. 1038 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 1039 Language) XML-Signature Syntax and Processing", RFC 3275, 1040 March 2002. 1042 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 1043 Internet: Timestamps", RFC 3339, July 2002. 1045 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 1046 Unique IDentifier (UUID) URN Namespace", RFC 4122, 1047 July 2005. 1049 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1050 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1051 May 2008. 1053 [RFC6755] Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace 1054 for OAuth", RFC 6755, October 2012. 1056 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 1057 Specifications and Registration Procedures", BCP 13, 1058 RFC 6838, January 2013. 1060 [SWT] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", 1061 Version 0.9.5.1, November 2009. 1063 [W3C.CR-xml11-20021015] 1064 Cowan, J., "Extensible Markup Language (XML) 1.1", W3C 1065 CR CR-xml11-20021015, October 2002. 1067 [W3C.REC-xml-c14n-20010315] 1068 Boyer, J., "Canonical XML Version 1.0", World Wide Web 1069 Consortium Recommendation REC-xml-c14n-20010315, 1070 March 2001, 1071 . 1073 Appendix A. JWT Examples 1075 This section contains examples of JWTs. For other example JWTs, see 1076 Section 6.1 and Appendices A.1, A.2, and A.3 of [JWS]. 1078 A.1. Example Encrypted JWT 1080 This example encrypts the same claims as used in Section 3.1 to the 1081 recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 1083 The following example JOSE Header declares that: 1085 o The Content Encryption Key is encrypted to the recipient using the 1086 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. 1088 o Authenticated encryption is performed on the Plaintext using the 1089 AES_128_CBC_HMAC_SHA_256 algorithm to produce the JWE Ciphertext 1090 and the JWE Authentication Tag. 1092 {"alg":"RSA1_5","enc":"A128CBC-HS256"} 1094 Other than using the octets of the UTF-8 representation of the JWT 1095 Claims Set from Section 3.1 as the plaintext value, the computation 1096 of this JWT is identical to the computation of the JWE in Appendix 1097 A.2 of [JWE], including the keys used. 1099 The final result in this example (with line breaks for display 1100 purposes only) is: 1102 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. 1103 QR1Owv2ug2WyPBnbQrRARTeEk9kDO2w8qDcjiHnSJflSdv1iNqhWXaKH4MqAkQtM 1104 oNfABIPJaZm0HaA415sv3aeuBWnD8J-Ui7Ah6cWafs3ZwwFKDFUUsWHSK-IPKxLG 1105 TkND09XyjORj_CHAgOPJ-Sd8ONQRnJvWn_hXV1BNMHzUjPyYwEsRhDhzjAD26ima 1106 sOTsgruobpYGoQcXUwFDn7moXPRfDE8-NoQX7N7ZYMmpUDkR-Cx9obNGwJQ3nM52 1107 YCitxoQVPzjbl7WBuB7AohdBoZOdZ24WlN1lVIeh8v1K4krB8xgKvRU8kgFrEn_a 1108 1rZgN5TiysnmzTROF869lQ. 1109 AxY8DCtDaGlsbGljb3RoZQ. 1110 MKOle7UQrG6nSxTLX6Mqwt0orbHvAKeWnDYvpIAeZ72deHxz3roJDXQyhxx0wKaM 1111 HDjUEOKIwrtkHthpqEanSBNYHZgmNOV7sln1Eu9g3J8. 1112 fiK51VwhsxJ-siBMR-YFiA 1114 A.2. Example Nested JWT 1116 This example shows how a JWT can be used as the payload of a JWE or 1117 JWS to create a Nested JWT. In this case, the JWT Claims Set is 1118 first signed, and then encrypted. 1120 The inner signed JWT is identical to the example in Appendix A.2 of 1121 [JWS]. Therefore, its computation is not repeated here. This 1122 example then encrypts this inner JWT to the recipient using RSAES- 1123 PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 1125 The following example JOSE Header declares that: 1127 o The Content Encryption Key is encrypted to the recipient using the 1128 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. 1130 o Authenticated encryption is performed on the Plaintext using the 1131 AES_128_CBC_HMAC_SHA_256 algorithm to produce the JWE Ciphertext 1132 and the JWE Authentication Tag. 1134 o The Plaintext is itself a JWT. 1136 {"alg":"RSA1_5","enc":"A128CBC-HS256","cty":"JWT"} 1138 Base64url encoding the octets of the UTF-8 representation of the JOSE 1139 Header yields this encoded JOSE Header value: 1141 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldUIn0 1143 The computation of this JWT is identical to the computation of the 1144 JWE in Appendix A.2 of [JWE], other than that different JOSE Header, 1145 Plaintext, JWE Initialization Vector, and Content Encryption Key 1146 values are used. (The RSA key used is the same.) 1148 The Payload used is the octets of the ASCII [RFC20] representation of 1149 the JWT at the end of Appendix A.2.1 of [JWS] (with all whitespace 1150 and line breaks removed), which is a sequence of 458 octets. 1152 The JWE Initialization Vector value used (using JSON array notation) 1153 is: 1155 [82, 101, 100, 109, 111, 110, 100, 32, 87, 65, 32, 57, 56, 48, 53, 1156 50] 1158 This example uses the Content Encryption Key represented by the 1159 base64url encoded value below: 1161 GawgguFyGrWKav7AX4VKUg 1163 The final result for this Nested JWT (with line breaks for display 1164 purposes only) is: 1166 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldU 1167 In0. 1168 g_hEwksO1Ax8Qn7HoN-BVeBoa8FXe0kpyk_XdcSmxvcM5_P296JXXtoHISr_DD_M 1169 qewaQSH4dZOQHoUgKLeFly-9RI11TG-_Ge1bZFazBPwKC5lJ6OLANLMd0QSL4fYE 1170 b9ERe-epKYE3xb2jfY1AltHqBO-PM6j23Guj2yDKnFv6WO72tteVzm_2n17SBFvh 1171 DuR9a2nHTE67pe0XGBUS_TK7ecA-iVq5COeVdJR4U4VZGGlxRGPLRHvolVLEHx6D 1172 YyLpw30Ay9R6d68YCLi9FYTq3hIXPK_-dmPlOUlKvPr1GgJzRoeC9G5qCvdcHWsq 1173 JGTO_z3Wfo5zsqwkxruxwA. 1174 UmVkbW9uZCBXQSA5ODA1Mg. 1175 VwHERHPvCNcHHpTjkoigx3_ExK0Qc71RMEParpatm0X_qpg-w8kozSjfNIPPXiTB 1176 BLXR65CIPkFqz4l1Ae9w_uowKiwyi9acgVztAi-pSL8GQSXnaamh9kX1mdh3M_TT 1177 -FZGQFQsFhu0Z72gJKGdfGE-OE7hS1zuBD5oEUfk0Dmb0VzWEzpxxiSSBbBAzP10 1178 l56pPfAtrjEYw-7ygeMkwBl6Z_mLS6w6xUgKlvW6ULmkV-uLC4FUiyKECK4e3WZY 1179 Kw1bpgIqGYsw2v_grHjszJZ-_I5uM-9RA8ycX9KqPRp9gc6pXmoU_-27ATs9XCvr 1180 ZXUtK2902AUzqpeEUJYjWWxSNsS-r1TJ1I-FMJ4XyAiGrfmo9hQPcNBYxPz3GQb2 1181 8Y5CLSQfNgKSGt0A4isp1hBUXBHAndgtcslt7ZoQJaKe_nNJgNliWtWpJ_ebuOpE 1182 l8jdhehdccnRMIwAmU1n7SPkmhIl1HlSOpvcvDfhUN5wuqU955vOBvfkBOh5A11U 1183 zBuo2WlgZ6hYi9-e3w29bR0C2-pp3jbqxEDw3iWaf2dc5b-LnR0FEYXvI_tYk5rd 1184 _J9N0mg0tQ6RbpxNEMNoA9QWk5lgdPvbh9BaO195abQ. 1185 AVO9iT5AV4CzvDJCdhSFlQ 1187 Appendix B. Relationship of JWTs to SAML Assertions 1189 SAML 2.0 [OASIS.saml-core-2.0-os] provides a standard for creating 1190 security tokens with greater expressivity and more security options 1191 than supported by JWTs. However, the cost of this flexibility and 1192 expressiveness is both size and complexity. SAML's use of XML 1193 [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] contributes to the 1194 size of SAML assertions; its use of XML and especially XML 1195 Canonicalization [W3C.REC-xml-c14n-20010315] contributes to their 1196 complexity. 1198 JWTs are intended to provide a simple security token format that is 1199 small enough to fit into HTTP headers and query arguments in URIs. 1200 It does this by supporting a much simpler token model than SAML and 1201 using the JSON [RFC7159] object encoding syntax. It also supports 1202 securing tokens using Message Authentication Codes (MACs) and digital 1203 signatures using a smaller (and less flexible) format than XML DSIG. 1205 Therefore, while JWTs can do some of the things SAML assertions do, 1206 JWTs are not intended as a full replacement for SAML assertions, but 1207 rather as a token format to be used when ease of implementation or 1208 compactness are considerations. 1210 SAML Assertions are always statements made by an entity about a 1211 subject. JWTs are often used in the same manner, with the entity 1212 making the statements being represented by the "iss" (issuer) claim, 1213 and the subject being represented by the "sub" (subject) claim. 1214 However, with these claims being optional, other uses of the JWT 1215 format are also permitted. 1217 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) 1219 Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets 1220 of claims to be communicated between applications. For SWTs, both 1221 the claim names and claim values are strings. For JWTs, while claim 1222 names are strings, claim values can be any JSON type. Both token 1223 types offer cryptographic protection of their content: SWTs with HMAC 1224 SHA-256 and JWTs with a choice of algorithms, including signature, 1225 MAC, and encryption algorithms. 1227 Appendix D. Acknowledgements 1229 The authors acknowledge that the design of JWTs was intentionally 1230 influenced by the design and simplicity of Simple Web Tokens [SWT] 1231 and ideas for JSON tokens that Dick Hardt discussed within the OpenID 1232 community. 1234 Solutions for signing JSON content were previously explored by Magic 1235 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 1236 Applications [CanvasApp], all of which influenced this draft. 1238 This specification is the work of the OAuth Working Group, which 1239 includes dozens of active and dedicated participants. In particular, 1240 the following individuals contributed ideas, feedback, and wording 1241 that influenced this specification: 1243 Dirk Balfanz, Richard Barnes, Brian Campbell, Alissa Cooper, Breno de 1244 Medeiros, Stephen Farrell, Dick Hardt, Joe Hildebrand, Jeff Hodges, 1245 Edmund Jay, Yaron Y. Goland, Warren Kumari, Ben Laurie, Barry Leiba, 1246 Ted Lemon, James Manger, Prateek Mishra, Kathleen Moriarty, Tony 1247 Nadalin, Axel Nennker, John Panzer, Emmanuel Raviart, David Recordon, 1248 Eric Rescorla, Jim Schaad, Paul Tarjan, Hannes Tschofenig, Sean 1249 Turner, and Tom Yu. 1251 Hannes Tschofenig and Derek Atkins chaired the OAuth working group 1252 and Sean Turner, Stephen Farrell, and Kathleen Moriarty served as 1253 Security area directors during the creation of this specification. 1255 Appendix E. Document History 1257 [[ to be removed by the RFC Editor before publication as an RFC ]] 1259 -32 1261 o Replaced uses of the phrases "JWS object" and "JWE object" with 1262 "JWS" and "JWE". 1264 o Applied other minor editorial improvements. 1266 -31 1268 o Updated the example IANA registration request subject line. 1270 -30 1272 o Applied privacy wording supplied by Stephen Farrell. 1274 o Clarified where white space and line breaks may occur in JSON 1275 objects by referencing Section 2 of RFC 7159. 1277 o Specified that registration reviews occur on the 1278 jwt-reg-review@ietf.org mailing list. 1280 -29 1282 o Used real values for examples in the IANA Registration Template. 1284 -28 1286 o Addressed IESG review comments by Alissa Cooper, Barry Leiba, 1287 Stephen Farrell, Ted Lemon, and Richard Barnes. 1289 o Changed the RFC 6755 reference to be informative, based upon 1290 related IESG review feedback on draft-ietf-oauth-saml2-bearer. 1292 -27 1294 o Removed unused reference to RFC 4648. 1296 o Changed to use the term "authenticated encryption" instead of 1297 "encryption", where appropriate. 1299 o Changed the registration review period to three weeks. 1301 o Acknowledged additional contributors. 1303 -26 1305 o Removed an ambiguity in numeric date representations by specifying 1306 that leap seconds are handled in the manner specified by POSIX.1. 1308 o Addressed Gen-ART review comments by Russ Housley. 1310 o Addressed secdir review comments by Warren Kumari and Stephen 1311 Kent. 1313 o Replaced the terms Plaintext JWS and Plaintext JWT with Unsecured 1314 JWS and Unsecured JWT. 1316 -25 1318 o Reworded the language about JWT implementations ignoring the "typ" 1319 parameter, explicitly saying that its processing is performed by 1320 JWT applications. 1322 o Added a Privacy Considerations section. 1324 -24 1326 o Cleaned up the reference syntax in a few places. 1328 o Applied minor wording changes to the Security Considerations 1329 section. 1331 -23 1333 o Replaced the terms JWS Header, JWE Header, and JWT Header with a 1334 single JOSE Header term defined in the JWS specification. This 1335 also enabled a single Header Parameter definition to be used and 1336 reduced other areas of duplication between specifications. 1338 -22 1340 o Revised the introduction to the Security Considerations section. 1341 Also introduced subsection headings for security considerations 1342 items. 1344 o Added text about when applications typically would and would not 1345 use the "typ" header parameter. 1347 -21 1349 o Removed unnecessary informative JWK spec reference. 1351 -20 1353 o Changed the RFC 6755 reference to be normative. 1355 o Changed the JWK reference to be informative. 1357 o Described potential sources of ambiguity in representing the JSON 1358 objects used in the examples. The octets of the actual UTF-8 1359 representations of the JSON objects used in the examples are 1360 included to remove these ambiguities. 1362 o Noted that octet sequences are depicted using JSON array notation. 1364 -19 1366 o Specified that support for Nested JWTs is optional and that 1367 applications using this specification can impose additional 1368 requirements upon implementations that they use. 1370 o Updated the JSON reference to RFC 7159. 1372 -18 1374 o Clarified that the base64url encoding includes no line breaks, 1375 white space, or other additional characters. 1377 o Removed circularity in the audience claim definition. 1379 o Clarified that it is entirely up to applications which claims to 1380 use. 1382 o Changed "SHOULD" to "MUST" in "in the absence of such 1383 requirements, all claims that are not understood by 1384 implementations MUST be ignored". 1386 o Clarified that applications can define their own processing rules 1387 for claims replicated in header parameters, rather than always 1388 requiring that they be identical in the JWT Header and JWT Claims 1389 Set. 1391 o Removed a JWT creation step that duplicated a step in the 1392 underlying JWS or JWE creation. 1394 o Added security considerations about using JWTs in trust decisions. 1396 -17 1398 o Corrected RFC 2119 terminology usage. 1400 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 1402 -16 1404 o Changed some references from being normative to informative, per 1405 JOSE issue #90. 1407 -15 1409 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis. 1411 -14 1413 o Referenced the JWE section on Distinguishing between JWS and JWE 1414 Objects. 1416 -13 1418 o Added Claim Description registry field. 1420 o Used Header Parameter Description registry field. 1422 o Removed the phrases "JWA signing algorithms" and "JWA encryption 1423 algorithms". 1425 o Removed the term JSON Text Object. 1427 -12 1429 o Tracked the JOSE change refining the "typ" and "cty" definitions 1430 to always be MIME Media Types, with the omission of "application/" 1431 prefixes recommended for brevity. For compatibility with legacy 1432 implementations, it is RECOMMENDED that "JWT" always be spelled 1433 using uppercase characters when used as a "typ" or "cty" value. 1435 As side effects, this change removed the "typ" Claim definition 1436 and narrowed the uses of the URI 1437 "urn:ietf:params:oauth:token-type:jwt". 1439 o Updated base64url definition to match JOSE definition. 1441 o Changed terminology from "Reserved Claim Name" to "Registered 1442 Claim Name" to match JOSE terminology change. 1444 o Applied other editorial changes to track parallel JOSE changes. 1446 o Clarified that the subject value may be scoped to be locally 1447 unique in the context of the issuer or may be globally unique. 1449 -11 1451 o Added a Nested JWT example. 1453 o Added "sub" to the list of Claims registered for use as Header 1454 Parameter values when an unencrypted representation is required in 1455 an encrypted JWT. 1457 -10 1459 o Allowed Claims to be replicated as Header Parameters in encrypted 1460 JWTs as needed by applications that require an unencrypted 1461 representation of specific Claims. 1463 -09 1465 o Clarified that the "typ" header parameter is used in an 1466 application-specific manner and has no effect upon the JWT 1467 processing. 1469 o Stated that recipients MUST either reject JWTs with duplicate 1470 Header Parameter Names or with duplicate Claim Names or use a JSON 1471 parser that returns only the lexically last duplicate member name. 1473 -08 1475 o Tracked a change to how JWEs are computed (which only affected the 1476 example encrypted JWT value). 1478 -07 1480 o Defined that the default action for claims that are not understood 1481 is to ignore them unless otherwise specified by applications. 1483 o Changed from using the term "byte" to "octet" when referring to 8 1484 bit values. 1486 o Tracked encryption computation changes in the JWE specification. 1488 -06 1490 o Changed the name of the "prn" claim to "sub" (subject) both to 1491 more closely align with SAML name usage and to use a more 1492 intuitive name. 1494 o Allow JWTs to have multiple audiences. 1496 o Applied editorial improvements suggested by Jeff Hodges, Prateek 1497 Mishra, and Hannes Tschofenig. Many of these simplified the 1498 terminology used. 1500 o Explained why Nested JWTs should be signed and then encrypted. 1502 o Clarified statements of the form "This claim is OPTIONAL" to "Use 1503 of this claim is OPTIONAL". 1505 o Referenced String Comparison Rules in JWS. 1507 o Added seriesInfo information to Internet Draft references. 1509 -05 1511 o Updated values for example AES CBC calculations. 1513 -04 1515 o Promoted Initialization Vector from being a header parameter to 1516 being a top-level JWE element. This saves approximately 16 bytes 1517 in the compact serialization, which is a significant savings for 1518 some use cases. Promoting the Initialization Vector out of the 1519 header also avoids repeating this shared value in the JSON 1520 serialization. 1522 o Applied changes made by the RFC Editor to RFC 6749's registry 1523 language to this specification. 1525 o Reference RFC 6755 -- An IETF URN Sub-Namespace for OAuth. 1527 -03 1529 o Added statement that "StringOrURI values are compared as case- 1530 sensitive strings with no transformations or canonicalizations 1531 applied". 1533 o Indented artwork elements to better distinguish them from the body 1534 text. 1536 -02 1538 o Added an example of an encrypted JWT. 1540 o Added this language to Registration Templates: "This name is case 1541 sensitive. Names that match other registered names in a case 1542 insensitive manner SHOULD NOT be accepted." 1544 o Applied editorial suggestions. 1546 -01 1548 o Added the "cty" (content type) header parameter for declaring type 1549 information about the secured content, as opposed to the "typ" 1550 (type) header parameter, which declares type information about 1551 this object. This significantly simplified nested JWTs. 1553 o Moved description of how to determine whether a header is for a 1554 JWS or a JWE from the JWT spec to the JWE spec. 1556 o Changed registration requirements from RFC Required to 1557 Specification Required with Expert Review. 1559 o Added Registration Template sections for defined registries. 1561 o Added Registry Contents sections to populate registry values. 1563 o Added "Collision Resistant Namespace" to the terminology section. 1565 o Numerous editorial improvements. 1567 -00 1569 o Created the initial IETF draft based upon 1570 draft-jones-json-web-token-10 with no normative changes. 1572 Authors' Addresses 1574 Michael B. Jones 1575 Microsoft 1577 Email: mbj@microsoft.com 1578 URI: http://self-issued.info/ 1580 John Bradley 1581 Ping Identity 1583 Email: ve7jtb@ve7jtb.com 1584 URI: http://www.thread-safe.com/ 1586 Nat Sakimura 1587 Nomura Research Institute 1589 Email: n-sakimura@nri.co.jp 1590 URI: http://nat.sakimura.org/