idnits 2.17.1 draft-ietf-oauth-json-web-token-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The document date (July 29, 2013) is 3918 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'ECMAScript' ** Obsolete normative reference: RFC 4288 (Obsoleted by RFC 6838) ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Downref: Normative reference to an Informational RFC: RFC 6755 Summary: 4 errors (**), 0 flaws (~~), 2 warnings (==), 2 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 30, 2014 Ping Identity 6 N. Sakimura 7 NRI 8 July 29, 2013 10 JSON Web Token (JWT) 11 draft-ietf-oauth-json-web-token-11 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 30, 2014. 42 Copyright Notice 44 Copyright (c) 2013 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 7 65 4.1. Reserved Claim Names . . . . . . . . . . . . . . . . . . . 8 66 4.1.1. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . . 8 67 4.1.2. "sub" (Subject) Claim . . . . . . . . . . . . . . . . 8 68 4.1.3. "aud" (Audience) Claim . . . . . . . . . . . . . . . . 8 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 . . . . . . . . . . . . . . . . . 9 73 4.1.8. "typ" (Type) Claim . . . . . . . . . . . . . . . . . . 9 74 4.2. Public Claim Names . . . . . . . . . . . . . . . . . . . . 10 75 4.3. Private Claim Names . . . . . . . . . . . . . . . . . . . 10 76 5. JWT Header . . . . . . . . . . . . . . . . . . . . . . . . . . 10 77 5.1. "typ" (Type) Header Parameter . . . . . . . . . . . . . . 10 78 5.2. "cty" (Content Type) Header Parameter . . . . . . . . . . 11 79 5.3. Replicating Claims as Header Parameters . . . . . . . . . 11 80 6. Plaintext JWTs . . . . . . . . . . . . . . . . . . . . . . . . 11 81 6.1. Example Plaintext JWT . . . . . . . . . . . . . . . . . . 12 82 7. Rules for Creating and Validating a JWT . . . . . . . . . . . 12 83 7.1. String Comparison Rules . . . . . . . . . . . . . . . . . 14 84 8. Cryptographic Algorithms . . . . . . . . . . . . . . . . . . . 14 85 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 86 9.1. JSON Web Token Claims Registry . . . . . . . . . . . . . . 15 87 9.1.1. Registration Template . . . . . . . . . . . . . . . . 16 88 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 16 89 9.2. Sub-Namespace Registration of 90 urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . . 17 91 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 17 92 9.3. JSON Web Signature and Encryption Type Values 93 Registration . . . . . . . . . . . . . . . . . . . . . . . 17 94 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 17 95 9.4. Media Type Registration . . . . . . . . . . . . . . . . . 17 96 9.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 17 97 9.5. Registration of JWE Header Parameter Names . . . . . . . . 18 98 9.5.1. Registry Contents . . . . . . . . . . . . . . . . . . 18 99 10. Security Considerations . . . . . . . . . . . . . . . . . . . 19 100 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 19 101 11.1. Normative References . . . . . . . . . . . . . . . . . . . 19 102 11.2. Informative References . . . . . . . . . . . . . . . . . . 20 103 Appendix A. JWT Examples . . . . . . . . . . . . . . . . . . . . 21 104 A.1. Example Encrypted JWT . . . . . . . . . . . . . . . . . . 21 105 A.2. Example Nested JWT . . . . . . . . . . . . . . . . . . . . 22 106 Appendix B. Relationship of JWTs to SAML Assertions . . . . . . . 24 107 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) . . 25 108 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 25 109 Appendix E. Document History . . . . . . . . . . . . . . . . . . 25 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 28 112 1. Introduction 114 JSON Web Token (JWT) is a compact claims representation format 115 intended for space constrained environments such as HTTP 116 Authorization headers and URI query parameters. JWTs encode claims 117 to be transmitted as a JavaScript Object Notation (JSON) [RFC4627] 118 object that is used as the payload of a JSON Web Signature (JWS) 119 [JWS] structure or as the plaintext of a JSON Web Encryption (JWE) 120 [JWE] structure, enabling the claims to be digitally signed or MACed 121 and/or encrypted. JWTs are always represented using the JWS Compact 122 Serialization or the JWE Compact Serialization. 124 The suggested pronunciation of JWT is the same as the English word 125 "jot". 127 1.1. Notational Conventions 129 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 130 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 131 document are to be interpreted as described in Key words for use in 132 RFCs to Indicate Requirement Levels [RFC2119]. 134 2. Terminology 136 JSON Web Token (JWT) A string representing a set of claims as a JSON 137 object that is encoded in a JWS or JWE, enabling the claims to be 138 digitally signed or MACed and/or encrypted. 140 Base64url Encoding The URL- and filename-safe Base64 encoding 141 described in RFC 4648 [RFC4648], Section 5, with the (non URL- 142 safe) '=' padding characters omitted, as permitted by Section 3.2. 143 (See Appendix C of [JWS] for notes on implementing base64url 144 encoding without padding.) 146 JSON Text Object A UTF-8 [RFC3629] encoded text string representing 147 a JSON object; the syntax of JSON objects is defined in Section 148 2.2 of [RFC4627]. 150 JWT Header A JSON Text Object that describes the cryptographic 151 operations applied to the JWT. When the JWT is digitally signed 152 or MACed, the JWT Header is a JWS Header. When the JWT is 153 encrypted, the JWT Header is a JWE Header. 155 Header Parameter Name The name of a member of the JWT Header. 157 Header Parameter Value The value of a member of the JWT Header. 159 JWT Claims Set A JSON Text Object that contains the Claims conveyed 160 by the JWT. 162 Claim 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 The name portion of a Claim representation. A Claim Name 167 is always a string. 169 Claim Value The value portion of a Claim representation. A Claim 170 Value can be any JSON value. 172 Encoded JWT Header Base64url encoding of the JWT Header. 174 Nested JWT A JWT in which nested signing and/or encryption are 175 employed. In nested JWTs, a JWT is used as the payload or 176 plaintext value of an enclosing JWS or JWE structure, 177 respectively. 179 Plaintext JWT A JWT whose Claims are not integrity protected or 180 encrypted. 182 Collision Resistant Namespace A namespace that allows names to be 183 allocated in a manner such that they are highly unlikely to 184 collide with other names. For instance, collision resistance can 185 be achieved through administrative delegation of portions of the 186 namespace or through use of collision-resistant name allocation 187 functions. Examples of Collision Resistant Namespaces include: 188 Domain Names, Object Identifiers (OIDs) as defined in the ITU-T 189 X.660 and X.670 Recommendation series, and Universally Unique 190 IDentifiers (UUIDs) [RFC4122]. When using an administratively 191 delegated namespace, the definer of a name needs to take 192 reasonable precautions to ensure they are in control of the 193 portion of the namespace they use to define the name. 195 StringOrURI A JSON string value, with the additional requirement 196 that while arbitrary string values MAY be used, any value 197 containing a ":" character MUST be a URI [RFC3986]. StringOrURI 198 values are compared as case-sensitive strings with no 199 transformations or canonicalizations applied. 201 IntDate A JSON numeric value representing the number of seconds from 202 1970-01-01T0:0:0Z UTC until the specified UTC date/time. See RFC 203 3339 [RFC3339] for details regarding date/times in general and UTC 204 in particular. 206 3. JSON Web Token (JWT) Overview 208 JWTs represent a set of claims as a JSON object that is encoded in a 209 JWS and/or JWE structure. This JSON object is the JWT Claims Set. As 210 per RFC 4627 [RFC4627] Section 2.2, the JSON object consists of zero 211 or more name/value pairs (or members), where the names are strings 212 and the values are arbitrary JSON values. These members are the 213 claims represented by the JWT. 215 The member names within the JWT Claims Set are referred to as Claim 216 Names. The corresponding values are referred to as Claim Values. 218 The contents of the JWT Header describe the cryptographic operations 219 applied to the JWT Claims Set. If the JWT Header is a JWS Header, the 220 JWT is represented as a JWS, and the claims are digitally signed or 221 MACed, with the JWT Claims Set being the JWS Payload. If the JWT 222 Header is a JWE Header, the JWT is represented as a JWE, and the 223 claims are encrypted, with the JWT Claims Set being the input 224 Plaintext. A JWT may be enclosed in another JWE or JWS structure to 225 create a Nested JWT, enabling nested signing and encryption to be 226 performed. 228 A JWT is represented as a sequence of URL-safe parts separated by 229 period ('.') characters. Each part contains a base64url encoded 230 value. The number of parts in the JWT is dependent upon the 231 representation of the resulting JWS or JWE object using the JWS 232 Compact Serialization or the JWE Compact Serialization. 234 3.1. Example JWT 236 The following example JWT Header declares that the encoded object is 237 a JSON Web Token (JWT) and the JWT is MACed using the HMAC SHA-256 238 algorithm: 240 {"typ":"JWT", 241 "alg":"HS256"} 243 Base64url encoding the octets of the UTF-8 representation of the JWT 244 Header yields this Encoded JWS Header value, which is used as the 245 Encoded JWT Header: 247 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 249 The following is an example of a JWT Claims Set: 251 {"iss":"joe", 252 "exp":1300819380, 253 "http://example.com/is_root":true} 255 The following octet sequence, which is the UTF-8 representation of 256 the JWT Claims Set above, is the JWS Payload: 258 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 259 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 260 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 261 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 262 111, 116, 34, 58, 116, 114, 117, 101, 125] 264 Base64url encoding the JWS Payload yields this Encoded JWS Payload 265 (with line breaks for display purposes only): 267 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly 268 9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ 270 Signing the Encoded JWS Header and Encoded JWS Payload with the HMAC 271 SHA-256 algorithm and base64url encoding the signature in the manner 272 specified in [JWS], yields this Encoded JWS Signature: 274 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 276 Concatenating these parts in this order with period ('.') characters 277 between the parts yields this complete JWT (with line breaks for 278 display purposes only): 280 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 281 . 282 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 283 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 284 . 285 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 287 This computation is illustrated in more detail in Appendix A.1 of 288 [JWS]. See Appendix A.1 for an example of an encrypted JWT. 290 4. JWT Claims 292 The JWT Claims Set represents a JSON object whose members are the 293 claims conveyed by the JWT. The Claim Names within a JWT Claims Set 294 MUST be unique; recipients MUST either reject JWTs with duplicate 295 Claim Names or use a JSON parser that returns only the lexically last 296 duplicate member name, as specified in Section 15.12 (The JSON 297 Object) of ECMAScript 5.1 [ECMAScript]. 299 The set of claims that a JWT must contain to be considered valid is 300 context-dependent and is outside the scope of this specification. 301 Specific applications of JWTs will require implementations to 302 understand and process some claims in particular ways. However, in 303 the absence of such requirements, all claims that are not understood 304 by implementations SHOULD be ignored. 306 There are three classes of JWT Claim Names: Reserved Claim Names, 307 Public Claim Names, and Private Claim Names. 309 4.1. Reserved Claim Names 311 The following Claim Names are reserved. None of the claims defined 312 below are intended to be mandatory to use, but rather, provide a 313 starting point for a set of useful, interoperable claims. All the 314 names are short because a core goal of JWTs is for the representation 315 to be compact. Additional reserved Claim Names can be defined via 316 the IANA JSON Web Token Claims registry Section 9.1. 318 4.1.1. "iss" (Issuer) Claim 320 The "iss" (issuer) claim identifies the principal that issued the 321 JWT. The processing of this claim is generally application specific. 322 The "iss" value is a case sensitive string containing a StringOrURI 323 value. Use of this claim is OPTIONAL. 325 4.1.2. "sub" (Subject) Claim 327 The "sub" (subject) claim identifies the principal that is the 328 subject of the JWT. The Claims in a JWT are normally statements 329 about the subject. The processing of this claim is generally 330 application specific. The "sub" value is a case sensitive string 331 containing a StringOrURI value. Use of this claim is OPTIONAL. 333 4.1.3. "aud" (Audience) Claim 335 The "aud" (audience) claim identifies the audiences that the JWT is 336 intended for. Each principal intended to process the JWT MUST 337 identify itself with a value in audience claim. If the principal 338 processing the claim does not identify itself with a value in the 339 "aud" claim, then the JWT MUST be rejected. In the general case, the 340 "aud" value is an array of case sensitive strings, each containing a 341 StringOrURI value. In the special case when the JWT has one 342 audience, the "aud" value MAY be a single case sensitive string 343 containing a StringOrURI value. The interpretation of audience 344 values is generally application specific. Use of this claim is 345 OPTIONAL. 347 4.1.4. "exp" (Expiration Time) Claim 349 The "exp" (expiration time) claim identifies the expiration time on 350 or after which the JWT MUST NOT be accepted for processing. The 351 processing of the "exp" claim requires that the current date/time 352 MUST be before the expiration date/time listed in the "exp" claim. 353 Implementers MAY provide for some small leeway, usually no more than 354 a few minutes, to account for clock skew. Its value MUST be a number 355 containing an IntDate value. Use of this claim is OPTIONAL. 357 4.1.5. "nbf" (Not Before) Claim 359 The "nbf" (not before) claim identifies the time before which the JWT 360 MUST NOT be accepted for processing. The processing of the "nbf" 361 claim requires that the current date/time MUST be after or equal to 362 the not-before date/time listed in the "nbf" claim. Implementers MAY 363 provide for some small leeway, usually no more than a few minutes, to 364 account for clock skew. Its value MUST be a number containing an 365 IntDate value. Use of this claim is OPTIONAL. 367 4.1.6. "iat" (Issued At) Claim 369 The "iat" (issued at) claim identifies the time at which the JWT was 370 issued. This claim can be used to determine the age of the JWT. Its 371 value MUST be a number containing an IntDate value. Use of this 372 claim is OPTIONAL. 374 4.1.7. "jti" (JWT ID) Claim 376 The "jti" (JWT ID) claim provides a unique identifier for the JWT. 377 The identifier value MUST be assigned in a manner that ensures that 378 there is a negligible probability that the same value will be 379 accidentally assigned to a different data object. The "jti" claim 380 can be used to prevent the JWT from being replayed. The "jti" value 381 is a case sensitive string. Use of this claim is OPTIONAL. 383 4.1.8. "typ" (Type) Claim 385 The "typ" (type) claim MAY be used to declare a type for the contents 386 of this JWT Claims Set in an application-specific manner in contexts 387 where this is useful to the application. The "typ" value is a case 388 sensitive string. Use of this claim is OPTIONAL. 390 The values used for the "typ" claim come from the same value space as 391 the "typ" header parameter, with the same rules applying. 393 4.2. Public Claim Names 395 Claim Names can be defined at will by those using JWTs. However, in 396 order to prevent collisions, any new Claim Name SHOULD either be 397 registered in the IANA JSON Web Token Claims registry Section 9.1 or 398 be a Public Name: a value that contains a Collision Resistant 399 Namespace. In each case, the definer of the name or value needs to 400 take reasonable precautions to make sure they are in control of the 401 part of the namespace they use to define the Claim Name. 403 4.3. Private Claim Names 405 A producer and consumer of a JWT MAY agree to use Claim Names that 406 are Private Names: names that are not Reserved Names Section 4.1 or 407 Public Names Section 4.2. Unlike Public Names, Private Names are 408 subject to collision and should be used with caution. 410 5. JWT Header 412 The members of the JSON object represented by the JWT Header describe 413 the cryptographic operations applied to the JWT and optionally, 414 additional properties of the JWT. The member names within the JWT 415 Header are referred to as Header Parameter Names. These names MUST 416 be unique; recipients MUST either reject JWTs with duplicate Header 417 Parameter Names or use a JSON parser that returns only the lexically 418 last duplicate member name, as specified in Section 15.12 (The JSON 419 Object) of ECMAScript 5.1 [ECMAScript]. The corresponding values are 420 referred to as Header Parameter Values. 422 JWS Header Parameters are defined by [JWS]. JWE Header Parameters 423 are defined by [JWE]. This specification further specifies the use 424 of the following header parameter in both the cases where the JWT is 425 a JWS and where it is a JWE. 427 5.1. "typ" (Type) Header Parameter 429 The "typ" (type) header parameter MAY be used to declare the type of 430 this JWT in an application-specific manner in contexts where this is 431 useful to the application. This parameter has no effect upon the JWT 432 processing. If present, it is RECOMMENDED that its value be either 433 "JWT" or "urn:ietf:params:oauth:token-type:jwt" to indicate that this 434 object is a JWT. The "typ" value is a case sensitive string. Use of 435 this header parameter is OPTIONAL. 437 5.2. "cty" (Content Type) Header Parameter 439 The "cty" (content type) header parameter is used to declare 440 structural information about the JWT. Its value MUST be a string. 442 In the normal case where nested signing or encryption operations are 443 not employed, the use of this header parameter is NOT RECOMMENDED. 444 In the case that nested signing or encryption is employed, the use of 445 this header parameter is REQUIRED; in this case, the value MUST be 446 "JWT", to indicate that a Nested JWT is carried in this JWT. See 447 Appendix A.2 for an example of a Nested JWT. 449 The values used for the "cty" header parameter come from the same 450 value space as the "typ" header parameter, with the same rules 451 applying. 453 5.3. Replicating Claims as Header Parameters 455 In some applications using encrypted JWTs, it is useful to have an 456 unencrypted representation of some Claims. This might be used, for 457 instance, in application processing rules to determine whether and 458 how to process the JWT before it is decrypted. 460 This specification allows Claims present in the JWT Claims Set to be 461 replicated as Header Parameters in a JWT that is a JWE, as needed by 462 the application. If such replicated Claims are present, the 463 application receiving them SHOULD verify that their values are 464 identical. It is the responsibility of the application to ensure 465 that only claims that are safe to be transmitted in an unencrypted 466 manner are replicated as Header Parameter values in the JWT. 468 This specification reserves the "iss" (issuer), "sub" (subject), and 469 "aud" (audience) Header Parameter Names for the purpose of providing 470 unencrypted replicas of these Claims in encrypted JWTs for 471 applications that need them. Other specifications MAY similarly 472 reserve other names that are reserved Claim Names as Header Parameter 473 Names, as needed. 475 6. Plaintext JWTs 477 To support use cases where the JWT content is secured by a means 478 other than a signature and/or encryption contained within the JWT 479 (such as a signature on a data structure containing the JWT), JWTs 480 MAY also be created without a signature or encryption. A plaintext 481 JWT is a JWS using the "none" JWS "alg" header parameter value 482 defined in JSON Web Algorithms (JWA) [JWA]; it is a JWS with the 483 empty string for its JWS Signature value. 485 6.1. Example Plaintext JWT 487 The following example JWT Header declares that the encoded object is 488 a Plaintext JWT: 490 {"alg":"none"} 492 Base64url encoding the octets of the UTF-8 representation of the JWT 493 Header yields this Encoded JWT Header: 495 eyJhbGciOiJub25lIn0 497 The following is an example of a JWT Claims Set: 499 {"iss":"joe", 500 "exp":1300819380, 501 "http://example.com/is_root":true} 503 Base64url encoding the octets of the UTF-8 representation of the JWT 504 Claims Set yields this Encoded JWS Payload (with line breaks for 505 display purposes only): 507 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 508 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 510 The Encoded JWS Signature is the empty string. 512 Concatenating these parts in this order with period ('.') characters 513 between the parts yields this complete JWT (with line breaks for 514 display purposes only): 516 eyJhbGciOiJub25lIn0 517 . 518 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 519 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 520 . 522 7. Rules for Creating and Validating a JWT 524 To create a JWT, one MUST perform these steps. The order of the 525 steps is not significant in cases where there are no dependencies 526 between the inputs and outputs of the steps. 528 1. Create a JWT Claims Set containing the desired claims. Note that 529 white space is explicitly allowed in the representation and no 530 canonicalization need be performed before encoding. 532 2. Let the Message be the octets of the UTF-8 representation of the 533 JWT Claims Set. 535 3. Create a JWT Header containing the desired set of header 536 parameters. The JWT MUST conform to either the [JWS] or [JWE] 537 specifications. Note that white space is explicitly allowed in 538 the representation and no canonicalization need be performed 539 before encoding. 541 4. Base64url encode the octets of the UTF-8 representation of the 542 JWT Header. Let this be the Encoded JWT Header. 544 5. Depending upon whether the JWT is a JWS or JWE, there are two 545 cases: 547 * If the JWT is a JWS, create a JWS using the JWT Header as the 548 JWS Header and the Message as the JWS Payload; all steps 549 specified in [JWS] for creating a JWS MUST be followed. 551 * Else, if the JWT is a JWE, create a JWE using the JWT Header 552 as the JWE Header and the Message as the JWE Plaintext; all 553 steps specified in [JWE] for creating a JWE MUST be followed. 555 6. If a nested signing or encryption operation will be performed, 556 let the Message be the JWS or JWE, and return to Step 3, using a 557 "cty" (content type) value of "JWT" in the new JWT Header created 558 in that step. 560 7. Otherwise, let the resulting JWT be the JWS or JWE. 562 When validating a JWT the following steps MUST be taken. The order 563 of the steps is not significant in cases where there are no 564 dependencies between the inputs and outputs of the steps. If any of 565 the listed steps fails then the JWT MUST be rejected for processing. 567 1. The JWT MUST contain at least one period ('.') character. 569 2. Let the Encoded JWT Header be the portion of the JWT before the 570 first period ('.') character. 572 3. The Encoded JWT Header MUST be successfully base64url decoded 573 following the restriction given in this specification that no 574 padding characters have been used. 576 4. The resulting JWT Header MUST be completely valid JSON syntax 577 conforming to RFC 4627 [RFC4627]. 579 5. The resulting JWT Header MUST be validated to only include 580 parameters and values whose syntax and semantics are both 581 understood and supported or that are specified as being ignored 582 when not understood. 584 6. Determine whether the JWT is a JWS or a JWE by examining the 585 "alg" (algorithm) header value and optionally, the "enc" 586 (encryption method) header value, if present. 588 7. Depending upon whether the JWT is a JWS or JWE, there are two 589 cases: 591 * If the JWT is a JWS, all steps specified in [JWS] for 592 validating a JWS MUST be followed. Let the Message be the 593 result of base64url decoding the JWS Payload. 595 * Else, if the JWT is a JWE, all steps specified in [JWE] for 596 validating a JWE MUST be followed. Let the Message be the 597 JWE Plaintext. 599 8. If the JWT Header contains a "cty" (content type) value of 600 "JWT", then the Message is a JWT that was the subject of nested 601 signing or encryption operations. In this case, return to Step 602 1, using the Message as the JWT. 604 9. Otherwise, let the JWT Claims Set be the Message. 606 10. The JWT Claims Set MUST be completely valid JSON syntax 607 conforming to RFC 4627 [RFC4627]. 609 7.1. String Comparison Rules 611 Processing a JWT inevitably requires comparing known strings to 612 values in JSON objects. For example, in checking what the algorithm 613 is, the Unicode string encoding "alg" will be checked against the 614 member names in the JWT Header to see if there is a matching Header 615 Parameter Name. 617 Comparisons between JSON strings and other Unicode strings MUST be 618 performed by comparing Unicode code points without normalization as 619 specified in the String Comparison Rules in Section 5.3 of [JWS]. 621 8. Cryptographic Algorithms 623 JWTs use JSON Web Signature (JWS) [JWS] and JSON Web Encryption (JWE) 624 [JWE] to sign and/or encrypt the contents of the JWT. 626 Of the JWA signing algorithms, only HMAC SHA-256 ("HS256") and "none" 627 MUST be implemented by conforming JWT implementations. It is 628 RECOMMENDED that implementations also support RSASSA-PKCS1-V1_5 with 629 the SHA-256 hash algorithm ("RS256") and ECDSA using the P-256 curve 630 and the SHA-256 hash algorithm ("ES256"). Support for other 631 algorithms and key sizes is OPTIONAL. 633 If an implementation provides encryption capabilities, of the JWA 634 encryption algorithms, only RSAES-PKCS1-V1_5 with 2048 bit keys 635 ("RSA1_5"), AES Key Wrap with 128 and 256 bit keys ("A128KW" and 636 "A256KW"), and the composite authenticated encryption algorithm using 637 AES CBC and HMAC SHA-2 ("A128CBC-HS256" and "A256CBC-HS512") MUST be 638 implemented by conforming implementations. It is RECOMMENDED that 639 implementations also support using ECDH-ES to agree upon a key used 640 to wrap the Content Encryption Key ("ECDH-ES+A128KW" and 641 "ECDH-ES+A256KW") and AES in Galois/Counter Mode (GCM) with 128 bit 642 and 256 bit keys ("A128GCM" and "A256GCM"). Support for other 643 algorithms and key sizes is OPTIONAL. 645 9. IANA Considerations 647 9.1. JSON Web Token Claims Registry 649 This specification establishes the IANA JSON Web Token Claims 650 registry for reserved JWT Claim Names. The registry records the 651 reserved Claim Name and a reference to the specification that defines 652 it. This specification registers the Claim Names defined in 653 Section 4.1. 655 Values are registered with a Specification Required [RFC5226] after a 656 two-week review period on the [TBD]@ietf.org mailing list, on the 657 advice of one or more Designated Experts. However, to allow for the 658 allocation of values prior to publication, the Designated Expert(s) 659 may approve registration once they are satisfied that such a 660 specification will be published. 662 Registration requests must be sent to the [TBD]@ietf.org mailing list 663 for review and comment, with an appropriate subject (e.g., "Request 664 for access token type: example"). [[ Note to RFC-EDITOR: The name of 665 the mailing list should be determined in consultation with the IESG 666 and IANA. Suggested name: claims-reg-review. ]] 668 Within the review period, the Designated Expert(s) will either 669 approve or deny the registration request, communicating this decision 670 to the review list and IANA. Denials should include an explanation 671 and, if applicable, suggestions as to how to make the request 672 successful. 674 IANA must only accept registry updates from the Designated Expert(s) 675 and should direct all requests for registration to the review mailing 676 list. 678 9.1.1. Registration Template 680 Claim Name: 681 The name requested (e.g., "example"). This name is case 682 sensitive. Names that match other registered names in a case 683 insensitive manner SHOULD NOT be accepted. 685 Change Controller: 686 For Standards Track RFCs, state "IETF". For others, give the name 687 of the responsible party. Other details (e.g., postal address, 688 email address, home page URI) may also be included. 690 Specification Document(s): 691 Reference to the document(s) that specify the parameter, 692 preferably including URI(s) that can be used to retrieve copies of 693 the document(s). An indication of the relevant sections may also 694 be included but is not required. 696 9.1.2. Initial Registry Contents 698 o Claim Name: "iss" 699 o Change Controller: IETF 700 o Specification Document(s): Section 4.1.1 of [[ this document ]] 702 o Claim Name: "sub" 703 o Change Controller: IETF 704 o Specification Document(s): Section 4.1.2 of [[ this document ]] 706 o Claim Name: "aud" 707 o Change Controller: IETF 708 o Specification Document(s): Section 4.1.3 of [[ this document ]] 710 o Claim Name: "exp" 711 o Change Controller: IETF 712 o Specification Document(s): Section 4.1.4 of [[ this document ]] 714 o Claim Name: "nbf" 715 o Change Controller: IETF 716 o Specification Document(s): Section 4.1.5 of [[ this document ]] 718 o Claim Name: "iat" 719 o Change Controller: IETF 720 o Specification Document(s): Section 4.1.6 of [[ this document ]] 722 o Claim Name: "jti" 723 o Change Controller: IETF 724 o Specification Document(s): Section 4.1.7 of [[ this document ]] 726 o Claim Name: "typ" 727 o Change Controller: IETF 728 o Specification Document(s): Section 4.1.8 of [[ this document ]] 730 9.2. Sub-Namespace Registration of urn:ietf:params:oauth:token-type:jwt 732 9.2.1. Registry Contents 734 This specification registers the value "token-type:jwt" in the IANA 735 urn:ietf:params:oauth registry established in An IETF URN Sub- 736 Namespace for OAuth [RFC6755], which can be used to indicate that the 737 content is a JWT. 739 o URN: urn:ietf:params:oauth:token-type:jwt 740 o Common Name: JSON Web Token (JWT) Token Type 741 o Change Controller: IETF 742 o Specification Document(s): [[this document]] 744 9.3. JSON Web Signature and Encryption Type Values Registration 746 9.3.1. Registry Contents 748 This specification registers the "JWT" type value in the IANA JSON 749 Web Signature and Encryption Type Values registry [JWS], which can be 750 used to indicate that the content is a JWT. 752 o "typ" Header Parameter Value: "JWT" 753 o Abbreviation for MIME Type: application/jwt 754 o Change Controller: IETF 755 o Specification Document(s): Section 5.1 of [[ this document ]] 757 9.4. Media Type Registration 759 9.4.1. Registry Contents 761 This specification registers the "application/jwt" Media Type 762 [RFC2046] in the MIME Media Type registry [RFC4288], which can be 763 used to indicate that the content is a JWT. 765 o Type Name: application 766 o Subtype Name: jwt 767 o Required Parameters: n/a 768 o Optional Parameters: n/a 769 o Encoding considerations: JWT values are encoded as a series of 770 base64url encoded values (some of which may be the empty string) 771 separated by period ('.') characters 772 o Security Considerations: See the Security Considerations section 773 of [[ this document ]] 774 o Interoperability Considerations: n/a 775 o Published Specification: [[ this document ]] 776 o Applications that use this media type: OpenID Connect, Mozilla 777 Persona, Salesforce, Google, numerous others 778 o Additional Information: Magic number(s): n/a, File extension(s): 779 n/a, Macintosh file type code(s): n/a 780 o Person & email address to contact for further information: Michael 781 B. Jones, mbj@microsoft.com 782 o Intended Usage: COMMON 783 o Restrictions on Usage: none 784 o Author: Michael B. Jones, mbj@microsoft.com 785 o Change Controller: IETF 787 9.5. Registration of JWE Header Parameter Names 789 This specification registers specific reserved Claim Names defined in 790 Section 4.1 in the IANA JSON Web Signature and Encryption Header 791 Parameters registry [JWS] for use by Claims replicated as Header 792 Parameters, per Section 5.3. 794 9.5.1. Registry Contents 796 o Header Parameter Name: "iss" 797 o Header Parameter Usage Location(s): JWE 798 o Change Controller: IETF 799 o Specification Document(s): Section 4.1.1 of [[ this document ]] 801 o Header Parameter Name: "sub" 802 o Header Parameter Usage Location(s): JWE 803 o Change Controller: IETF 804 o Specification Document(s): Section 4.1.2 of [[ this document ]] 806 o Header Parameter Name: "aud" 807 o Header Parameter Usage Location(s): JWE 808 o Change Controller: IETF 809 o Specification Document(s): Section 4.1.3 of [[ this document ]] 811 10. Security Considerations 813 All of the security issues faced by any cryptographic application 814 must be faced by a JWT/JWS/JWE/JWK agent. Among these issues are 815 protecting the user's private and symmetric keys, preventing various 816 attacks, and helping the user avoid mistakes such as inadvertently 817 encrypting a message for the wrong recipient. The entire list of 818 security considerations is beyond the scope of this document. 820 All the security considerations in the JWS specification also apply 821 to JWT, as do the JWE security considerations when encryption is 822 employed. In particular, the JWS JSON Security Considerations and 823 Unicode Comparison Security Considerations apply equally to the JWT 824 Claims Set in the same manner that they do to the JWS Header. 826 While syntactically, the signing and encryption operations for Nested 827 JWTs may be applied in any order, normally senders should sign the 828 message and then encrypt the result (thus encrypting the signature). 829 This prevents attacks in which the signature is stripped, leaving 830 just an encrypted message, as well as providing privacy for the 831 signer. Furthermore, signatures over encrypted text are not 832 considered valid in many jurisdictions. 834 Note that potential concerns about security issues related to the 835 order of signing and encryption operations are already addressed by 836 the underlying JWS and JWE specifications; in particular, because JWE 837 only supports the use of authenticated encryption algorithms, 838 cryptographic concerns about the potential need to sign after 839 encryption that apply in many contexts do not apply to this 840 specification. 842 11. References 844 11.1. Normative References 846 [ECMAScript] 847 Ecma International, "ECMAScript Language Specification, 848 5.1 Edition", ECMA 262, June 2011. 850 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 851 draft-ietf-jose-json-web-algorithms (work in progress), 852 July 2013. 854 [JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web 855 Encryption (JWE)", draft-ietf-jose-json-web-encryption 856 (work in progress), July 2013. 858 [JWK] Jones, M., "JSON Web Key (JWK)", 859 draft-ietf-jose-json-web-key (work in progress), 860 July 2013. 862 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 863 Signature (JWS)", draft-ietf-jose-json-web-signature (work 864 in progress), July 2013. 866 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 867 Extensions (MIME) Part Two: Media Types", RFC 2046, 868 November 1996. 870 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 871 Requirement Levels", BCP 14, RFC 2119, March 1997. 873 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 874 Internet: Timestamps", RFC 3339, July 2002. 876 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 877 10646", STD 63, RFC 3629, November 2003. 879 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 880 Resource Identifier (URI): Generic Syntax", STD 66, 881 RFC 3986, January 2005. 883 [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and 884 Registration Procedures", RFC 4288, December 2005. 886 [RFC4627] Crockford, D., "The application/json Media Type for 887 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 889 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 890 Encodings", RFC 4648, October 2006. 892 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 893 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 894 May 2008. 896 [RFC6755] Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace 897 for OAuth", RFC 6755, October 2012. 899 11.2. Informative References 901 [CanvasApp] 902 Facebook, "Canvas Applications", 2010. 904 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 905 September 2010. 907 [MagicSignatures] 908 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 909 Signatures", January 2011. 911 [OASIS.saml-core-2.0-os] 912 Cantor, S., Kemp, J., Philpott, R., and E. Maler, 913 "Assertions and Protocol for the OASIS Security Assertion 914 Markup Language (SAML) V2.0", OASIS Standard saml-core- 915 2.0-os, March 2005. 917 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 918 Language) XML-Signature Syntax and Processing", RFC 3275, 919 March 2002. 921 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 922 Unique IDentifier (UUID) URN Namespace", RFC 4122, 923 July 2005. 925 [SWT] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", 926 Version 0.9.5.1, November 2009. 928 [W3C.CR-xml11-20021015] 929 Cowan, J., "Extensible Markup Language (XML) 1.1", W3C 930 CR CR-xml11-20021015, October 2002. 932 [W3C.REC-xml-c14n-20010315] 933 Boyer, J., "Canonical XML Version 1.0", World Wide Web 934 Consortium Recommendation REC-xml-c14n-20010315, 935 March 2001, 936 . 938 Appendix A. JWT Examples 940 This section contains examples of JWTs. For other example JWTs, see 941 Section 6.1 and Appendices A.1, A.2, and A.3 of [JWS]. 943 A.1. Example Encrypted JWT 945 This example encrypts the same claims as used in Section 3.1 to the 946 recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 948 The following example JWE Header (with line breaks for display 949 purposes only) declares that: 951 o the Content Encryption Key is encrypted to the recipient using the 952 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and 954 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 955 algorithm to produce the Ciphertext. 957 {"alg":"RSA1_5","enc":"A128CBC-HS256"} 959 Other than using the octets of the UTF-8 representation of the JWT 960 Claims Set from Section 3.1 as the plaintext value, the computation 961 of this JWT is identical to the computation of the JWE in Appendix 962 A.2 of [JWE], including the keys used. 964 The final result in this example (with line breaks for display 965 purposes only) is: 967 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. 968 QR1Owv2ug2WyPBnbQrRARTeEk9kDO2w8qDcjiHnSJflSdv1iNqhWXaKH4MqAkQtM 969 oNfABIPJaZm0HaA415sv3aeuBWnD8J-Ui7Ah6cWafs3ZwwFKDFUUsWHSK-IPKxLG 970 TkND09XyjORj_CHAgOPJ-Sd8ONQRnJvWn_hXV1BNMHzUjPyYwEsRhDhzjAD26ima 971 sOTsgruobpYGoQcXUwFDn7moXPRfDE8-NoQX7N7ZYMmpUDkR-Cx9obNGwJQ3nM52 972 YCitxoQVPzjbl7WBuB7AohdBoZOdZ24WlN1lVIeh8v1K4krB8xgKvRU8kgFrEn_a 973 1rZgN5TiysnmzTROF869lQ. 974 AxY8DCtDaGlsbGljb3RoZQ. 975 MKOle7UQrG6nSxTLX6Mqwt0orbHvAKeWnDYvpIAeZ72deHxz3roJDXQyhxx0wKaM 976 HDjUEOKIwrtkHthpqEanSBNYHZgmNOV7sln1Eu9g3J8. 977 fiK51VwhsxJ-siBMR-YFiA 979 A.2. Example Nested JWT 981 This example shows how a JWT can be used as the payload of a JWE or 982 JWS to create a Nested JWT. In this case, the JWT Claims Set is 983 first signed, and then encrypted. 985 The inner signed JWT is identical to the example in Appendix A.2 of 986 [JWS]. Therefore, its computation is not repeated here. This 987 example then encrypts this inner JWT to the recipient using RSAES- 988 PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. 990 The following example JWE Header (with line breaks for display 991 purposes only) declares that: 993 o the Content Encryption Key is encrypted to the recipient using the 994 RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key, 996 o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 997 algorithm to produce the Ciphertext, and 999 o the Plaintext is itself a JWT. 1001 {"alg":"RSA1_5","enc":"A128CBC-HS256","cty":"JWT"} 1003 Base64url encoding the octets of the UTF-8 representation of the JWE 1004 Header yields this Encoded JWE Header value: 1006 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldUIn0 1008 The computation of this JWT is identical to the computation of the 1009 JWE in Appendix A.2 of [JWE], other than that different JWE Header, 1010 Plaintext, Initialization Vector, and Content Encryption Key values 1011 are used. (The RSA key used is the same.) 1013 The Payload used is the octets of the ASCII representation of the JWT 1014 at the end of Appendix Section A.2.1 of [JWS] (with all whitespace 1015 and line breaks removed), which is a sequence of 458 octets. 1017 The Initialization Vector value used is: 1019 [82, 101, 100, 109, 111, 110, 100, 32, 87, 65, 32, 57, 56, 48, 53, 1020 50] 1022 This example uses the Content Encryption Key represented in JSON Web 1023 Key [JWK] format below: 1025 {"kty":"oct", 1026 "k":"GawgguFyGrWKav7AX4VKUg" 1027 } 1029 The final result for this Nested JWT (with line breaks for display 1030 purposes only) is: 1032 eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldU 1033 In0. 1034 g_hEwksO1Ax8Qn7HoN-BVeBoa8FXe0kpyk_XdcSmxvcM5_P296JXXtoHISr_DD_M 1035 qewaQSH4dZOQHoUgKLeFly-9RI11TG-_Ge1bZFazBPwKC5lJ6OLANLMd0QSL4fYE 1036 b9ERe-epKYE3xb2jfY1AltHqBO-PM6j23Guj2yDKnFv6WO72tteVzm_2n17SBFvh 1037 DuR9a2nHTE67pe0XGBUS_TK7ecA-iVq5COeVdJR4U4VZGGlxRGPLRHvolVLEHx6D 1038 YyLpw30Ay9R6d68YCLi9FYTq3hIXPK_-dmPlOUlKvPr1GgJzRoeC9G5qCvdcHWsq 1039 JGTO_z3Wfo5zsqwkxruxwA. 1040 UmVkbW9uZCBXQSA5ODA1Mg. 1041 VwHERHPvCNcHHpTjkoigx3_ExK0Qc71RMEParpatm0X_qpg-w8kozSjfNIPPXiTB 1042 BLXR65CIPkFqz4l1Ae9w_uowKiwyi9acgVztAi-pSL8GQSXnaamh9kX1mdh3M_TT 1043 -FZGQFQsFhu0Z72gJKGdfGE-OE7hS1zuBD5oEUfk0Dmb0VzWEzpxxiSSBbBAzP10 1044 l56pPfAtrjEYw-7ygeMkwBl6Z_mLS6w6xUgKlvW6ULmkV-uLC4FUiyKECK4e3WZY 1045 Kw1bpgIqGYsw2v_grHjszJZ-_I5uM-9RA8ycX9KqPRp9gc6pXmoU_-27ATs9XCvr 1046 ZXUtK2902AUzqpeEUJYjWWxSNsS-r1TJ1I-FMJ4XyAiGrfmo9hQPcNBYxPz3GQb2 1047 8Y5CLSQfNgKSGt0A4isp1hBUXBHAndgtcslt7ZoQJaKe_nNJgNliWtWpJ_ebuOpE 1048 l8jdhehdccnRMIwAmU1n7SPkmhIl1HlSOpvcvDfhUN5wuqU955vOBvfkBOh5A11U 1049 zBuo2WlgZ6hYi9-e3w29bR0C2-pp3jbqxEDw3iWaf2dc5b-LnR0FEYXvI_tYk5rd 1050 _J9N0mg0tQ6RbpxNEMNoA9QWk5lgdPvbh9BaO195abQ. 1051 AVO9iT5AV4CzvDJCdhSFlQ 1053 Appendix B. Relationship of JWTs to SAML Assertions 1055 SAML 2.0 [OASIS.saml-core-2.0-os] provides a standard for creating 1056 security tokens with greater expressivity and more security options 1057 than supported by JWTs. However, the cost of this flexibility and 1058 expressiveness is both size and complexity. SAML's use of XML 1059 [W3C.CR-xml11-20021015] and XML DSIG [RFC3275] contributes to the 1060 size of SAML assertions; its use of XML and especially XML 1061 Canonicalization [W3C.REC-xml-c14n-20010315] contributes to their 1062 complexity. 1064 JWTs are intended to provide a simple security token format that is 1065 small enough to fit into HTTP headers and query arguments in URIs. 1066 It does this by supporting a much simpler token model than SAML and 1067 using the JSON [RFC4627] object encoding syntax. It also supports 1068 securing tokens using Message Authentication Codes (MACs) and digital 1069 signatures using a smaller (and less flexible) format than XML DSIG. 1071 Therefore, while JWTs can do some of the things SAML assertions do, 1072 JWTs are not intended as a full replacement for SAML assertions, but 1073 rather as a token format to be used when ease of implementation or 1074 compactness are considerations. 1076 SAML Assertions are always statements made by an entity about a 1077 subject. JWTs are often used in the same manner, with the entity 1078 making the statements being represented by the "iss" (issuer) claim, 1079 and the subject being represented by the "sub" (subject) claim. 1080 However, with these claims being optional, other uses of the JWT 1081 format are also permitted. 1083 Appendix C. Relationship of JWTs to Simple Web Tokens (SWTs) 1085 Both JWTs and Simple Web Tokens SWT [SWT], at their core, enable sets 1086 of claims to be communicated between applications. For SWTs, both 1087 the claim names and claim values are strings. For JWTs, while claim 1088 names are strings, claim values can be any JSON type. Both token 1089 types offer cryptographic protection of their content: SWTs with HMAC 1090 SHA-256 and JWTs with a choice of algorithms, including signature, 1091 MAC, and encryption algorithms. 1093 Appendix D. Acknowledgements 1095 The authors acknowledge that the design of JWTs was intentionally 1096 influenced by the design and simplicity of Simple Web Tokens [SWT] 1097 and ideas for JSON tokens that Dick Hardt discussed within the OpenID 1098 community. 1100 Solutions for signing JSON content were previously explored by Magic 1101 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 1102 Applications [CanvasApp], all of which influenced this draft. 1104 This specification is the work of the OAuth Working Group, which 1105 includes dozens of active and dedicated participants. In particular, 1106 the following individuals contributed ideas, feedback, and wording 1107 that influenced this specification: 1109 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 1110 Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben 1111 Laurie, James Manger, Prateek Mishra, Tony Nadalin, Axel Nennker, 1112 John Panzer, Emmanuel Raviart, David Recordon, Eric Rescorla, Jim 1113 Schaad, Paul Tarjan, Hannes Tschofenig, and Sean Turner. 1115 Hannes Tschofenig and Derek Atkins chaired the OAuth working group 1116 and Sean Turner and Stephen Farrell served as Security area directors 1117 during the creation of this specification. 1119 Appendix E. Document History 1121 [[ to be removed by the RFC editor before publication as an RFC ]] 1123 -11 1124 o Added a Nested JWT example. 1126 o Added "sub" to the list of Claims registered for use as Header 1127 Parameter values when an unencrypted representation is required in 1128 an encrypted JWT. 1130 -10 1132 o Allowed Claims to be replicated as Header Parameters in encrypted 1133 JWTs as needed by applications that require an unencrypted 1134 representation of specific Claims. 1136 -09 1138 o Clarified that the "typ" header parameter is used in an 1139 application-specific manner and has no effect upon the JWT 1140 processing. 1142 o Stated that recipients MUST either reject JWTs with duplicate 1143 Header Parameter Names or with duplicate Claim Names or use a JSON 1144 parser that returns only the lexically last duplicate member name. 1146 -08 1148 o Tracked a change to how JWEs are computed (which only affected the 1149 example encrypted JWT value). 1151 -07 1153 o Defined that the default action for claims that are not understood 1154 is to ignore them unless otherwise specified by applications. 1156 o Changed from using the term "byte" to "octet" when referring to 8 1157 bit values. 1159 o Tracked encryption computation changes in the JWE specification. 1161 -06 1163 o Changed the name of the "prn" claim to "sub" (subject) both to 1164 more closely align with SAML name usage and to use a more 1165 intuitive name. 1167 o Allow JWTs to have multiple audiences. 1169 o Applied editorial improvements suggested by Jeff Hodges, Prateek 1170 Mishra, and Hannes Tschofenig. Many of these simplified the 1171 terminology used. 1173 o Explained why Nested JWTs should be signed and then encrypted. 1175 o Clarified statements of the form "This claim is OPTIONAL" to "Use 1176 of this claim is OPTIONAL". 1178 o Referenced String Comparison Rules in JWS. 1180 o Added seriesInfo information to Internet Draft references. 1182 -05 1184 o Updated values for example AES CBC calculations. 1186 -04 1188 o Promoted Initialization Vector from being a header parameter to 1189 being a top-level JWE element. This saves approximately 16 bytes 1190 in the compact serialization, which is a significant savings for 1191 some use cases. Promoting the Initialization Vector out of the 1192 header also avoids repeating this shared value in the JSON 1193 serialization. 1195 o Applied changes made by the RFC Editor to RFC 6749's registry 1196 language to this specification. 1198 o Reference RFC 6755 -- An IETF URN Sub-Namespace for OAuth. 1200 -03 1202 o Added statement that "StringOrURI values are compared as case- 1203 sensitive strings with no transformations or canonicalizations 1204 applied". 1206 o Indented artwork elements to better distinguish them from the body 1207 text. 1209 -02 1211 o Added an example of an encrypted JWT. 1213 o Added this language to Registration Templates: "This name is case 1214 sensitive. Names that match other registered names in a case 1215 insensitive manner SHOULD NOT be accepted." 1217 o Applied editorial suggestions. 1219 -01 1220 o Added the "cty" (content type) header parameter for declaring type 1221 information about the secured content, as opposed to the "typ" 1222 (type) header parameter, which declares type information about 1223 this object. This significantly simplified nested JWTs. 1225 o Moved description of how to determine whether a header is for a 1226 JWS or a JWE from the JWT spec to the JWE spec. 1228 o Changed registration requirements from RFC Required to 1229 Specification Required with Expert Review. 1231 o Added Registration Template sections for defined registries. 1233 o Added Registry Contents sections to populate registry values. 1235 o Added "Collision Resistant Namespace" to the terminology section. 1237 o Numerous editorial improvements. 1239 -00 1241 o Created the initial IETF draft based upon 1242 draft-jones-json-web-token-10 with no normative changes. 1244 Authors' Addresses 1246 Michael B. Jones 1247 Microsoft 1249 Email: mbj@microsoft.com 1250 URI: http://self-issued.info/ 1252 John Bradley 1253 Ping Identity 1255 Email: ve7jtb@ve7jtb.com 1257 Nat Sakimura 1258 Nomura Research Institute 1260 Email: n-sakimura@nri.co.jp