1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677
|
<pre>Internet Engineering Task Force (IETF) M. Jones
Request for Comments: 7519 Microsoft
Category: Standards Track J. Bradley
ISSN: 2070-1721 Ping Identity
N. Sakimura
NRI
May 2015
<span class="h1">JSON Web Token (JWT)</span>
Abstract
JSON Web Token (JWT) is a compact, URL-safe means of representing
claims to be transferred between two parties. The claims in a JWT
are encoded as a JSON object that is used as the payload of a JSON
Web Signature (JWS) structure or as the plaintext of a JSON Web
Encryption (JWE) structure, enabling the claims to be digitally
signed or integrity protected with a Message Authentication Code
(MAC) and/or encrypted.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc7519">http://www.rfc-editor.org/info/rfc7519</a>.
<span class="grey">Jones, et al. Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Jones, et al. Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-1.1">1.1</a>. Notational Conventions . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-2">2</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-3">3</a>. JSON Web Token (JWT) Overview . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<a href="#section-3.1">3.1</a>. Example JWT . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-7">7</a>
<a href="#section-4">4</a>. JWT Claims . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-4.1">4.1</a>. Registered Claim Names . . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-4.1.1">4.1.1</a>. "iss" (Issuer) Claim . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-4.1.2">4.1.2</a>. "sub" (Subject) Claim . . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-4.1.3">4.1.3</a>. "aud" (Audience) Claim . . . . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-4.1.4">4.1.4</a>. "exp" (Expiration Time) Claim . . . . . . . . . . . . <a href="#page-9">9</a>
<a href="#section-4.1.5">4.1.5</a>. "nbf" (Not Before) Claim . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-4.1.6">4.1.6</a>. "iat" (Issued At) Claim . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-4.1.7">4.1.7</a>. "jti" (JWT ID) Claim . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-4.2">4.2</a>. Public Claim Names . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-4.3">4.3</a>. Private Claim Names . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-5">5</a>. JOSE Header . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-11">11</a>
<a href="#section-5.1">5.1</a>. "typ" (Type) Header Parameter . . . . . . . . . . . . . . <a href="#page-11">11</a>
<a href="#section-5.2">5.2</a>. "cty" (Content Type) Header Parameter . . . . . . . . . . <a href="#page-11">11</a>
<a href="#section-5.3">5.3</a>. Replicating Claims as Header Parameters . . . . . . . . . <a href="#page-12">12</a>
<a href="#section-6">6</a>. Unsecured JWTs . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-12">12</a>
<a href="#section-6.1">6.1</a>. Example Unsecured JWT . . . . . . . . . . . . . . . . . . <a href="#page-12">12</a>
<a href="#section-7">7</a>. Creating and Validating JWTs . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-7.1">7.1</a>. Creating a JWT . . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-7.2">7.2</a>. Validating a JWT . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-7.3">7.3</a>. String Comparison Rules . . . . . . . . . . . . . . . . . <a href="#page-15">15</a>
<a href="#section-8">8</a>. Implementation Requirements . . . . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-9">9</a>. URI for Declaring that Content is a JWT . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-10">10</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-10.1">10.1</a>. JSON Web Token Claims Registry . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-10.1.1">10.1.1</a>. Registration Template . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-10.1.2">10.1.2</a>. Initial Registry Contents . . . . . . . . . . . . . <a href="#page-18">18</a>
10.2. Sub-Namespace Registration of
urn:ietf:params:oauth:token-type:jwt . . . . . . . . . . <a href="#page-19">19</a>
<a href="#section-10.2.1">10.2.1</a>. Registry Contents . . . . . . . . . . . . . . . . . <a href="#page-19">19</a>
<a href="#section-10.3">10.3</a>. Media Type Registration . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-10.3.1">10.3.1</a>. Registry Contents . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-10.4">10.4</a>. Header Parameter Names Registration . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-10.4.1">10.4.1</a>. Registry Contents . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-11">11</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-11.1">11.1</a>. Trust Decisions . . . . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-11.2">11.2</a>. Signing and Encryption Order . . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-12">12</a>. Privacy Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-22">22</a>
<a href="#section-13">13</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-22">22</a>
<a href="#section-13.1">13.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-22">22</a>
<a href="#section-13.2">13.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-23">23</a>
<span class="grey">Jones, et al. Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<a href="#appendix-A">Appendix A</a>. JWT Examples . . . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#appendix-A.1">A.1</a>. Example Encrypted JWT . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#appendix-A.2">A.2</a>. Example Nested JWT . . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#appendix-B">Appendix B</a>. Relationship of JWTs to SAML Assertions . . . . . . <a href="#page-28">28</a>
<a href="#appendix-C">Appendix C</a>. Relationship of JWTs to Simple Web Tokens (SWTs) . . <a href="#page-28">28</a>
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-28">28</a>
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-29">29</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
JSON Web Token (JWT) is a compact claims representation format
intended for space constrained environments such as HTTP
Authorization headers and URI query parameters. JWTs encode claims
to be transmitted as a JSON [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>] object that is used as the
payload of a JSON Web Signature (JWS) [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] structure or as the
plaintext of a JSON Web Encryption (JWE) [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>] structure, enabling
the claims to be digitally signed or integrity protected with a
Message Authentication Code (MAC) and/or encrypted. JWTs are always
represented using the JWS Compact Serialization or the JWE Compact
Serialization.
The suggested pronunciation of JWT is the same as the English word
"jot".
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Notational Conventions</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
"Key words for use in RFCs to Indicate Requirement Levels" [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
The interpretation should only be applied when the terms appear in
all capital letters.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
The terms "JSON Web Signature (JWS)", "Base64url Encoding", "Header
Parameter", "JOSE Header", "JWS Compact Serialization", "JWS
Payload", "JWS Signature", and "Unsecured JWS" are defined by the JWS
specification [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>].
The terms "JSON Web Encryption (JWE)", "Content Encryption Key
(CEK)", "JWE Compact Serialization", "JWE Encrypted Key", and "JWE
Initialization Vector" are defined by the JWE specification [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>].
The terms "Ciphertext", "Digital Signature", "Message Authentication
Code (MAC)", and "Plaintext" are defined by the "Internet Security
Glossary, Version 2" [<a href="./rfc4949" title=""Internet Security Glossary, Version 2"">RFC4949</a>].
<span class="grey">Jones, et al. Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
These terms are defined by this specification:
JSON Web Token (JWT)
A string representing a set of claims as a JSON object that is
encoded in a JWS or JWE, enabling the claims to be digitally
signed or MACed and/or encrypted.
JWT Claims Set
A JSON object that contains the claims conveyed by the JWT.
Claim
A piece of information asserted about a subject. A claim is
represented as a name/value pair consisting of a Claim Name and a
Claim Value.
Claim Name
The name portion of a claim representation. A Claim Name is
always a string.
Claim Value
The value portion of a claim representation. A Claim Value can be
any JSON value.
Nested JWT
A JWT in which nested signing and/or encryption are employed. In
Nested JWTs, a JWT is used as the payload or plaintext value of an
enclosing JWS or JWE structure, respectively.
Unsecured JWT
A JWT whose claims are not integrity protected or encrypted.
Collision-Resistant Name
A name in a namespace that enables names to be allocated in a
manner such that they are highly unlikely to collide with other
names. Examples of collision-resistant namespaces include: Domain
Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and
X.670 Recommendation series, and Universally Unique IDentifiers
(UUIDs) [<a href="./rfc4122" title=""A Universally Unique IDentifier (UUID) URN Namespace"">RFC4122</a>]. When using an administratively delegated
namespace, the definer of a name needs to take reasonable
precautions to ensure they are in control of the portion of the
namespace they use to define the name.
StringOrURI
A JSON string value, with the additional requirement that while
arbitrary string values MAY be used, any value containing a ":"
character MUST be a URI [<a href="./rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>]. StringOrURI values are
compared as case-sensitive strings with no transformations or
canonicalizations applied.
<span class="grey">Jones, et al. Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
NumericDate
A JSON numeric value representing the number of seconds from
1970-01-01T00:00:00Z UTC until the specified UTC date/time,
ignoring leap seconds. This is equivalent to the IEEE Std 1003.1,
2013 Edition [<a href="#ref-POSIX.1" title=""The Open Group Base Specifications Issue 7"">POSIX.1</a>] definition "Seconds Since the Epoch", in
which each day is accounted for by exactly 86400 seconds, other
than that non-integer values can be represented. See <a href="./rfc3339">RFC 3339</a>
[<a href="./rfc3339" title=""Date and Time on the Internet: Timestamps"">RFC3339</a>] for details regarding date/times in general and UTC in
particular.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. JSON Web Token (JWT) Overview</span>
JWTs represent a set of claims as a JSON object that is encoded in a
JWS and/or JWE structure. This JSON object is the JWT Claims Set.
As per <a href="./rfc7159#section-4">Section 4 of RFC 7159</a> [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>], the JSON object consists of
zero or more name/value pairs (or members), where the names are
strings and the values are arbitrary JSON values. These members are
the claims represented by the JWT. This JSON object MAY contain
whitespace and/or line breaks before or after any JSON values or
structural characters, in accordance with <a href="./rfc7159#section-2">Section 2 of RFC 7159</a>
[<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>].
The member names within the JWT Claims Set are referred to as Claim
Names. The corresponding values are referred to as Claim Values.
The contents of the JOSE Header describe the cryptographic operations
applied to the JWT Claims Set. If the JOSE Header is for a JWS, the
JWT is represented as a JWS and the claims are digitally signed or
MACed, with the JWT Claims Set being the JWS Payload. If the JOSE
Header is for a JWE, the JWT is represented as a JWE and the claims
are encrypted, with the JWT Claims Set being the plaintext encrypted
by the JWE. A JWT may be enclosed in another JWE or JWS structure to
create a Nested JWT, enabling nested signing and encryption to be
performed.
A JWT is represented as a sequence of URL-safe parts separated by
period ('.') characters. Each part contains a base64url-encoded
value. The number of parts in the JWT is dependent upon the
representation of the resulting JWS using the JWS Compact
Serialization or JWE using the JWE Compact Serialization.
<span class="grey">Jones, et al. Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Example JWT</span>
The following example JOSE Header declares that the encoded object is
a JWT, and the JWT is a JWS that is MACed using the HMAC SHA-256
algorithm:
{"typ":"JWT",
"alg":"HS256"}
To remove potential ambiguities in the representation of the JSON
object above, the octet sequence for the actual UTF-8 representation
used in this example for the JOSE Header above is also included
below. (Note that ambiguities can arise due to differing platform
representations of line breaks (CRLF versus LF), differing spacing at
the beginning and ends of lines, whether the last line has a
terminating line break or not, and other causes. In the
representation used in this example, the first line has no leading or
trailing spaces, a CRLF line break (13, 10) occurs between the first
and second lines, the second line has one leading space (32) and no
trailing spaces, and the last line does not have a terminating line
break.) The octets representing the UTF-8 representation of the JOSE
Header in this example (using JSON array notation) are:
[123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32,
34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125]
Base64url encoding the octets of the UTF-8 representation of the JOSE
Header yields this encoded JOSE Header value:
eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9
The following is an example of a JWT Claims Set:
{"iss":"joe",
"exp":1300819380,
"http://example.com/is_root":true}
The following octet sequence, which is the UTF-8 representation used
in this example for the JWT Claims Set above, is the JWS Payload:
[123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10,
32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56,
48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97,
109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111,
111, 116, 34, 58, 116, 114, 117, 101, 125]
<span class="grey">Jones, et al. Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Base64url encoding the JWS Payload yields this encoded JWS Payload
(with line breaks for display purposes only):
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly
9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ
Computing the MAC of the encoded JOSE Header and encoded JWS Payload
with the HMAC SHA-256 algorithm and base64url encoding the HMAC value
in the manner specified in [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] yields this encoded JWS Signature:
dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
Concatenating these encoded parts in this order with period ('.')
characters between the parts yields this complete JWT (with line
breaks for display purposes only):
eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9
.
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
.
dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
This computation is illustrated in more detail in <a href="#appendix-A.1">Appendix A.1</a> of
[<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>]. See <a href="#appendix-A.1">Appendix A.1</a> for an example of an encrypted JWT.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. JWT Claims</span>
The JWT Claims Set represents a JSON object whose members are the
claims conveyed by the JWT. The Claim Names within a JWT Claims Set
MUST be unique; JWT parsers MUST either reject JWTs with duplicate
Claim Names or use a JSON parser that returns only the lexically last
duplicate member name, as specified in <a href="#section-15.12">Section 15.12</a> ("The JSON
Object") of ECMAScript 5.1 [<a href="#ref-ECMAScript">ECMAScript</a>].
The set of claims that a JWT must contain to be considered valid is
context dependent and is outside the scope of this specification.
Specific applications of JWTs will require implementations to
understand and process some claims in particular ways. However, in
the absence of such requirements, all claims that are not understood
by implementations MUST be ignored.
There are three classes of JWT Claim Names: Registered Claim Names,
Public Claim Names, and Private Claim Names.
<span class="grey">Jones, et al. Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Registered Claim Names</span>
The following Claim Names are registered in the IANA "JSON Web Token
Claims" registry established by <a href="#section-10.1">Section 10.1</a>. None of the claims
defined below are intended to be mandatory to use or implement in all
cases, but rather they provide a starting point for a set of useful,
interoperable claims. Applications using JWTs should define which
specific claims they use and when they are required or optional. All
the names are short because a core goal of JWTs is for the
representation to be compact.
<span class="h4"><a class="selflink" id="section-4.1.1" href="#section-4.1.1">4.1.1</a>. "iss" (Issuer) Claim</span>
The "iss" (issuer) claim identifies the principal that issued the
JWT. The processing of this claim is generally application specific.
The "iss" value is a case-sensitive string containing a StringOrURI
value. Use of this claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.2" href="#section-4.1.2">4.1.2</a>. "sub" (Subject) Claim</span>
The "sub" (subject) claim identifies the principal that is the
subject of the JWT. The claims in a JWT are normally statements
about the subject. The subject value MUST either be scoped to be
locally unique in the context of the issuer or be globally unique.
The processing of this claim is generally application specific. The
"sub" value is a case-sensitive string containing a StringOrURI
value. Use of this claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.3" href="#section-4.1.3">4.1.3</a>. "aud" (Audience) Claim</span>
The "aud" (audience) claim identifies the recipients that the JWT is
intended for. Each principal intended to process the JWT MUST
identify itself with a value in the audience claim. If the principal
processing the claim does not identify itself with a value in the
"aud" claim when this claim is present, then the JWT MUST be
rejected. In the general case, the "aud" value is an array of case-
sensitive strings, each containing a StringOrURI value. In the
special case when the JWT has one audience, the "aud" value MAY be a
single case-sensitive string containing a StringOrURI value. The
interpretation of audience values is generally application specific.
Use of this claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.4" href="#section-4.1.4">4.1.4</a>. "exp" (Expiration Time) Claim</span>
The "exp" (expiration time) claim identifies the expiration time on
or after which the JWT MUST NOT be accepted for processing. The
processing of the "exp" claim requires that the current date/time
MUST be before the expiration date/time listed in the "exp" claim.
<span class="grey">Jones, et al. Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Implementers MAY provide for some small leeway, usually no more than
a few minutes, to account for clock skew. Its value MUST be a number
containing a NumericDate value. Use of this claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.5" href="#section-4.1.5">4.1.5</a>. "nbf" (Not Before) Claim</span>
The "nbf" (not before) claim identifies the time before which the JWT
MUST NOT be accepted for processing. The processing of the "nbf"
claim requires that the current date/time MUST be after or equal to
the not-before date/time listed in the "nbf" claim. Implementers MAY
provide for some small leeway, usually no more than a few minutes, to
account for clock skew. Its value MUST be a number containing a
NumericDate value. Use of this claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.6" href="#section-4.1.6">4.1.6</a>. "iat" (Issued At) Claim</span>
The "iat" (issued at) claim identifies the time at which the JWT was
issued. This claim can be used to determine the age of the JWT. Its
value MUST be a number containing a NumericDate value. Use of this
claim is OPTIONAL.
<span class="h4"><a class="selflink" id="section-4.1.7" href="#section-4.1.7">4.1.7</a>. "jti" (JWT ID) Claim</span>
The "jti" (JWT ID) claim provides a unique identifier for the JWT.
The identifier value MUST be assigned in a manner that ensures that
there is a negligible probability that the same value will be
accidentally assigned to a different data object; if the application
uses multiple issuers, collisions MUST be prevented among values
produced by different issuers as well. The "jti" claim can be used
to prevent the JWT from being replayed. The "jti" value is a case-
sensitive string. Use of this claim is OPTIONAL.
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Public Claim Names</span>
Claim Names can be defined at will by those using JWTs. However, in
order to prevent collisions, any new Claim Name should either be
registered in the IANA "JSON Web Token Claims" registry established
by <a href="#section-10.1">Section 10.1</a> or be a Public Name: a value that contains a
Collision-Resistant Name. In each case, the definer of the name or
value needs to take reasonable precautions to make sure they are in
control of the part of the namespace they use to define the Claim
Name.
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Private Claim Names</span>
A producer and consumer of a JWT MAY agree to use Claim Names that
are Private Names: names that are not Registered Claim Names
(<a href="#section-4.1">Section 4.1</a>) or Public Claim Names (<a href="#section-4.2">Section 4.2</a>). Unlike Public
<span class="grey">Jones, et al. Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Claim Names, Private Claim Names are subject to collision and should
be used with caution.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. JOSE Header</span>
For a JWT object, the members of the JSON object represented by the
JOSE Header describe the cryptographic operations applied to the JWT
and optionally, additional properties of the JWT. Depending upon
whether the JWT is a JWS or JWE, the corresponding rules for the JOSE
Header values apply.
This specification further specifies the use of the following Header
Parameters in both the cases where the JWT is a JWS and where it is a
JWE.
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. "typ" (Type) Header Parameter</span>
The "typ" (type) Header Parameter defined by [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] and [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>] is used
by JWT applications to declare the media type [<a href="#ref-IANA.MediaTypes">IANA.MediaTypes</a>] of
this complete JWT. This is intended for use by the JWT application
when values that are not JWTs could also be present in an application
data structure that can contain a JWT object; the application can use
this value to disambiguate among the different kinds of objects that
might be present. It will typically not be used by applications when
it is already known that the object is a JWT. This parameter is
ignored by JWT implementations; any processing of this parameter is
performed by the JWT application. If present, it is RECOMMENDED that
its value be "JWT" to indicate that this object is a JWT. While
media type names are not case sensitive, it is RECOMMENDED that "JWT"
always be spelled using uppercase characters for compatibility with
legacy implementations. Use of this Header Parameter is OPTIONAL.
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. "cty" (Content Type) Header Parameter</span>
The "cty" (content type) Header Parameter defined by [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] and [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>]
is used by this specification to convey structural information about
the JWT.
In the normal case in which nested signing or encryption operations
are not employed, the use of this Header Parameter is NOT
RECOMMENDED. In the case that nested signing or encryption is
employed, this Header Parameter MUST be present; in this case, the
value MUST be "JWT", to indicate that a Nested JWT is carried in this
JWT. While media type names are not case sensitive, it is
RECOMMENDED that "JWT" always be spelled using uppercase characters
for compatibility with legacy implementations. See <a href="#appendix-A.2">Appendix A.2</a> for
an example of a Nested JWT.
<span class="grey">Jones, et al. Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Replicating Claims as Header Parameters</span>
In some applications using encrypted JWTs, it is useful to have an
unencrypted representation of some claims. This might be used, for
instance, in application processing rules to determine whether and
how to process the JWT before it is decrypted.
This specification allows claims present in the JWT Claims Set to be
replicated as Header Parameters in a JWT that is a JWE, as needed by
the application. If such replicated claims are present, the
application receiving them SHOULD verify that their values are
identical, unless the application defines other specific processing
rules for these claims. It is the responsibility of the application
to ensure that only claims that are safe to be transmitted in an
unencrypted manner are replicated as Header Parameter values in the
JWT.
<a href="#section-10.4.1">Section 10.4.1</a> of this specification registers the "iss" (issuer),
"sub" (subject), and "aud" (audience) Header Parameter names for the
purpose of providing unencrypted replicas of these claims in
encrypted JWTs for applications that need them. Other specifications
MAY similarly register other names that are registered Claim Names as
Header Parameter names, as needed.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Unsecured JWTs</span>
To support use cases in which the JWT content is secured by a means
other than a signature and/or encryption contained within the JWT
(such as a signature on a data structure containing the JWT), JWTs
MAY also be created without a signature or encryption. An Unsecured
JWT is a JWS using the "alg" Header Parameter value "none" and with
the empty string for its JWS Signature value, as defined in the JWA
specification [<a href="#ref-JWA" title=""JSON Web Algorithms (JWA)"">JWA</a>]; it is an Unsecured JWS with the JWT Claims Set
as its JWS Payload.
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Example Unsecured JWT</span>
The following example JOSE Header declares that the encoded object is
an Unsecured JWT:
{"alg":"none"}
Base64url encoding the octets of the UTF-8 representation of the JOSE
Header yields this encoded JOSE Header value:
eyJhbGciOiJub25lIn0
<span class="grey">Jones, et al. Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
The following is an example of a JWT Claims Set:
{"iss":"joe",
"exp":1300819380,
"http://example.com/is_root":true}
Base64url encoding the octets of the UTF-8 representation of the JWT
Claims Set yields this encoded JWS Payload (with line breaks for
display purposes only):
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
The encoded JWS Signature is the empty string.
Concatenating these encoded parts in this order with period ('.')
characters between the parts yields this complete JWT (with line
breaks for display purposes only):
eyJhbGciOiJub25lIn0
.
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Creating and Validating JWTs</span>
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Creating a JWT</span>
To create a JWT, the following steps are performed. The order of the
steps is not significant in cases where there are no dependencies
between the inputs and outputs of the steps.
1. Create a JWT Claims Set containing the desired claims. Note that
whitespace is explicitly allowed in the representation and no
canonicalization need be performed before encoding.
2. Let the Message be the octets of the UTF-8 representation of the
JWT Claims Set.
3. Create a JOSE Header containing the desired set of Header
Parameters. The JWT MUST conform to either the [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] or [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>]
specification. Note that whitespace is explicitly allowed in the
representation and no canonicalization need be performed before
encoding.
<span class="grey">Jones, et al. Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
4. Depending upon whether the JWT is a JWS or JWE, there are two
cases:
* If the JWT is a JWS, create a JWS using the Message as the JWS
Payload; all steps specified in [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] for creating a JWS MUST
be followed.
* Else, if the JWT is a JWE, create a JWE using the Message as
the plaintext for the JWE; all steps specified in [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>] for
creating a JWE MUST be followed.
5. If a nested signing or encryption operation will be performed,
let the Message be the JWS or JWE, and return to Step 3, using a
"cty" (content type) value of "JWT" in the new JOSE Header
created in that step.
6. Otherwise, let the resulting JWT be the JWS or JWE.
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Validating a JWT</span>
When validating a JWT, the following steps are performed. The order
of the steps is not significant in cases where there are no
dependencies between the inputs and outputs of the steps. If any of
the listed steps fail, then the JWT MUST be rejected -- that is,
treated by the application as an invalid input.
1. Verify that the JWT contains at least one period ('.')
character.
2. Let the Encoded JOSE Header be the portion of the JWT before the
first period ('.') character.
3. Base64url decode the Encoded JOSE Header following the
restriction that no line breaks, whitespace, or other additional
characters have been used.
4. Verify that the resulting octet sequence is a UTF-8-encoded
representation of a completely valid JSON object conforming to
<a href="./rfc7159">RFC 7159</a> [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>]; let the JOSE Header be this JSON object.
5. Verify that the resulting JOSE Header includes only parameters
and values whose syntax and semantics are both understood and
supported or that are specified as being ignored when not
understood.
6. Determine whether the JWT is a JWS or a JWE using any of the
methods described in Section 9 of [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>].
<span class="grey">Jones, et al. Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
7. Depending upon whether the JWT is a JWS or JWE, there are two
cases:
* If the JWT is a JWS, follow the steps specified in [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] for
validating a JWS. Let the Message be the result of base64url
decoding the JWS Payload.
* Else, if the JWT is a JWE, follow the steps specified in
[<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>] for validating a JWE. Let the Message be the resulting
plaintext.
8. If the JOSE Header contains a "cty" (content type) value of
"JWT", then the Message is a JWT that was the subject of nested
signing or encryption operations. In this case, return to Step
1, using the Message as the JWT.
9. Otherwise, base64url decode the Message following the
restriction that no line breaks, whitespace, or other additional
characters have been used.
10. Verify that the resulting octet sequence is a UTF-8-encoded
representation of a completely valid JSON object conforming to
<a href="./rfc7159">RFC 7159</a> [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>]; let the JWT Claims Set be this JSON object.
Finally, note that it is an application decision which algorithms may
be used in a given context. Even if a JWT can be successfully
validated, unless the algorithms used in the JWT are acceptable to
the application, it SHOULD reject the JWT.
<span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. String Comparison Rules</span>
Processing a JWT inevitably requires comparing known strings to
members and values in JSON objects. For example, in checking what
the algorithm is, the Unicode [<a href="#ref-UNICODE" title=""The Unicode Standard"">UNICODE</a>] string encoding "alg" will be
checked against the member names in the JOSE Header to see if there
is a matching Header Parameter name.
The JSON rules for doing member name comparison are described in
<a href="./rfc7159#section-8.3">Section 8.3 of RFC 7159</a> [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>]. Since the only string comparison
operations that are performed are equality and inequality, the same
rules can be used for comparing both member names and member values
against known strings.
These comparison rules MUST be used for all JSON string comparisons
except in cases where the definition of the member explicitly calls
out that a different comparison rule is to be used for that member
value. In this specification, only the "typ" and "cty" member values
do not use these comparison rules.
<span class="grey">Jones, et al. Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Some applications may include case-insensitive information in a case-
sensitive value, such as including a DNS name as part of the "iss"
(issuer) claim value. In those cases, the application may need to
define a convention for the canonical case to use for representing
the case-insensitive portions, such as lowercasing them, if more than
one party might need to produce the same value so that they can be
compared. (However, if all other parties consume whatever value the
producing party emitted verbatim without attempting to compare it to
an independently produced value, then the case used by the producer
will not matter.)
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Implementation Requirements</span>
This section defines which algorithms and features of this
specification are mandatory to implement. Applications using this
specification can impose additional requirements upon implementations
that they use. For instance, one application might require support
for encrypted JWTs and Nested JWTs, while another might require
support for signing JWTs with the Elliptic Curve Digital Signature
Algorithm (ECDSA) using the P-256 curve and the SHA-256 hash
algorithm ("ES256").
Of the signature and MAC algorithms specified in JSON Web Algorithms
[<a href="#ref-JWA" title=""JSON Web Algorithms (JWA)"">JWA</a>], only HMAC SHA-256 ("HS256") and "none" MUST be implemented by
conforming JWT implementations. It is RECOMMENDED that
implementations also support RSASSA-PKCS1-v1_5 with the SHA-256 hash
algorithm ("RS256") and ECDSA using the P-256 curve and the SHA-256
hash algorithm ("ES256"). Support for other algorithms and key sizes
is OPTIONAL.
Support for encrypted JWTs is OPTIONAL. If an implementation
provides encryption capabilities, of the encryption algorithms
specified in [<a href="#ref-JWA" title=""JSON Web Algorithms (JWA)"">JWA</a>], only RSAES-PKCS1-v1_5 with 2048-bit keys
("RSA1_5"), AES Key Wrap with 128- and 256-bit keys ("A128KW" and
"A256KW"), and the composite authenticated encryption algorithm using
AES-CBC and HMAC SHA-2 ("A128CBC-HS256" and "A256CBC-HS512") MUST be
implemented by conforming implementations. It is RECOMMENDED that
implementations also support using Elliptic Curve Diffie-Hellman
Ephemeral Static (ECDH-ES) to agree upon a key used to wrap the
Content Encryption Key ("ECDH-ES+A128KW" and "ECDH-ES+A256KW") and
AES in Galois/Counter Mode (GCM) with 128- and 256-bit keys
("A128GCM" and "A256GCM"). Support for other algorithms and key
sizes is OPTIONAL.
Support for Nested JWTs is OPTIONAL.
<span class="grey">Jones, et al. Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. URI for Declaring that Content is a JWT</span>
This specification registers the URN
"urn:ietf:params:oauth:token-type:jwt" for use by applications that
declare content types using URIs (rather than, for instance, media
types) to indicate that the content referred to is a JWT.
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. IANA Considerations</span>
<span class="h3"><a class="selflink" id="section-10.1" href="#section-10.1">10.1</a>. JSON Web Token Claims Registry</span>
This section establishes the IANA "JSON Web Token Claims" registry
for JWT Claim Names. The registry records the Claim Name and a
reference to the specification that defines it. This section
registers the Claim Names defined in <a href="#section-4.1">Section 4.1</a>.
Values are registered on a Specification Required [<a href="./rfc5226" title="">RFC5226</a>] basis
after a three-week review period on the jwt-reg-review@ietf.org
mailing list, on the advice of one or more Designated Experts.
However, to allow for the allocation of values prior to publication,
the Designated Experts may approve registration once they are
satisfied that such a specification will be published.
Registration requests sent to the mailing list for review should use
an appropriate subject (e.g., "Request to register claim: example").
Within the review period, the Designated Experts will either approve
or deny the registration request, communicating this decision to the
review list and IANA. Denials should include an explanation and, if
applicable, suggestions as to how to make the request successful.
Registration requests that are undetermined for a period longer than
21 days can be brought to the IESG's attention (using the
iesg@ietf.org mailing list) for resolution.
Criteria that should be applied by the Designated Experts includes
determining whether the proposed registration duplicates existing
functionality, whether it is likely to be of general applicability or
whether it is useful only for a single application, and whether the
registration description is clear.
IANA must only accept registry updates from the Designated Experts
and should direct all requests for registration to the review mailing
list.
It is suggested that multiple Designated Experts be appointed who are
able to represent the perspectives of different applications using
this specification, in order to enable broadly informed review of
registration decisions. In cases where a registration decision could
<span class="grey">Jones, et al. Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
be perceived as creating a conflict of interest for a particular
Expert, that Expert should defer to the judgment of the other
Experts.
<span class="h4"><a class="selflink" id="section-10.1.1" href="#section-10.1.1">10.1.1</a>. Registration Template</span>
Claim Name:
The name requested (e.g., "iss"). Because a core goal of this
specification is for the resulting representations to be compact,
it is RECOMMENDED that the name be short -- that is, not to exceed
8 characters without a compelling reason to do so. This name is
case sensitive. Names may not match other registered names in a
case-insensitive manner unless the Designated Experts state that
there is a compelling reason to allow an exception.
Claim Description:
Brief description of the claim (e.g., "Issuer").
Change Controller:
For Standards Track RFCs, list the "IESG". For others, give the
name of the responsible party. Other details (e.g., postal
address, email address, home page URI) may also be included.
Specification Document(s):
Reference to the document or documents that specify the parameter,
preferably including URIs that can be used to retrieve copies of
the documents. An indication of the relevant sections may also be
included but is not required.
<span class="h4"><a class="selflink" id="section-10.1.2" href="#section-10.1.2">10.1.2</a>. Initial Registry Contents</span>
o Claim Name: "iss"
o Claim Description: Issuer
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.1">Section 4.1.1 of RFC 7519</a>
o Claim Name: "sub"
o Claim Description: Subject
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.2">Section 4.1.2 of RFC 7519</a>
o Claim Name: "aud"
o Claim Description: Audience
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.3">Section 4.1.3 of RFC 7519</a>
<span class="grey">Jones, et al. Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
o Claim Name: "exp"
o Claim Description: Expiration Time
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.4">Section 4.1.4 of RFC 7519</a>
o Claim Name: "nbf"
o Claim Description: Not Before
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.5">Section 4.1.5 of RFC 7519</a>
o Claim Name: "iat"
o Claim Description: Issued At
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.6">Section 4.1.6 of RFC 7519</a>
o Claim Name: "jti"
o Claim Description: JWT ID
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.7">Section 4.1.7 of RFC 7519</a>
<span class="h3"><a class="selflink" id="section-10.2" href="#section-10.2">10.2</a>. Sub-Namespace Registration of</span>
<span class="h3"> urn:ietf:params:oauth:token-type:jwt</span>
<span class="h4"><a class="selflink" id="section-10.2.1" href="#section-10.2.1">10.2.1</a>. Registry Contents</span>
This section registers the value "token-type:jwt" in the IANA "OAuth
URI" registry established by "An IETF URN Sub-Namespace for OAuth"
[<a href="./rfc6755" title=""An IETF URN Sub-Namespace for OAuth"">RFC6755</a>], which can be used to indicate that the content is a JWT.
o URN: urn:ietf:params:oauth:token-type:jwt
o Common Name: JSON Web Token (JWT) Token Type
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519">RFC 7519</a>
<span class="grey">Jones, et al. Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h3"><a class="selflink" id="section-10.3" href="#section-10.3">10.3</a>. Media Type Registration</span>
<span class="h4"><a class="selflink" id="section-10.3.1" href="#section-10.3.1">10.3.1</a>. Registry Contents</span>
This section registers the "application/jwt" media type [<a href="./rfc2046" title=""Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"">RFC2046</a>] in
the "Media Types" registry [<a href="#ref-IANA.MediaTypes">IANA.MediaTypes</a>] in the manner described
in <a href="./rfc6838">RFC 6838</a> [<a href="./rfc6838" title=""Media Type Specifications and Registration Procedures"">RFC6838</a>], which can be used to indicate that the content
is a JWT.
o Type name: application
o Subtype name: jwt
o Required parameters: n/a
o Optional parameters: n/a
o Encoding considerations: 8bit; JWT values are encoded as a series
of base64url-encoded values (some of which may be the empty
string) separated by period ('.') characters.
o Security considerations: See the Security Considerations section
of <a href="./rfc7519">RFC 7519</a>
o Interoperability considerations: n/a
o Published specification: <a href="./rfc7519">RFC 7519</a>
o Applications that use this media type: OpenID Connect, Mozilla
Persona, Salesforce, Google, Android, Windows Azure, Amazon Web
Services, and numerous others
o Fragment identifier considerations: n/a
o Additional information:
Magic number(s): n/a
File extension(s): n/a
Macintosh file type code(s): n/a
o Person & email address to contact for further information:
Michael B. Jones, mbj@microsoft.com
o Intended usage: COMMON
o Restrictions on usage: none
o Author: Michael B. Jones, mbj@microsoft.com
o Change controller: IESG
o Provisional registration? No
<span class="h3"><a class="selflink" id="section-10.4" href="#section-10.4">10.4</a>. Header Parameter Names Registration</span>
This section registers specific Claim Names defined in <a href="#section-4.1">Section 4.1</a> in
the IANA "JSON Web Signature and Encryption Header Parameters"
registry established by [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] for use by claims replicated as Header
Parameters in JWEs, per <a href="#section-5.3">Section 5.3</a>.
<span class="grey">Jones, et al. Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h4"><a class="selflink" id="section-10.4.1" href="#section-10.4.1">10.4.1</a>. Registry Contents</span>
o Header Parameter Name: "iss"
o Header Parameter Description: Issuer
o Header Parameter Usage Location(s): JWE
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.1">Section 4.1.1 of RFC 7519</a>
o Header Parameter Name: "sub"
o Header Parameter Description: Subject
o Header Parameter Usage Location(s): JWE
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.2">Section 4.1.2 of RFC 7519</a>
o Header Parameter Name: "aud"
o Header Parameter Description: Audience
o Header Parameter Usage Location(s): JWE
o Change Controller: IESG
o Specification Document(s): <a href="./rfc7519#section-4.1.3">Section 4.1.3 of RFC 7519</a>
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Security Considerations</span>
All of the security issues that are pertinent to any cryptographic
application must be addressed by JWT/JWS/JWE/JWK agents. Among these
issues are protecting the user's asymmetric private and symmetric
secret keys and employing countermeasures to various attacks.
All the security considerations in the JWS specification also apply
to JWT, as do the JWE security considerations when encryption is
employed. In particular, Sections <a href="#section-10.12">10.12</a> ("JSON Security
Considerations") and 10.13 ("Unicode Comparison Security
Considerations") of [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] apply equally to the JWT Claims Set in the
same manner that they do to the JOSE Header.
<span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. Trust Decisions</span>
The contents of a JWT cannot be relied upon in a trust decision
unless its contents have been cryptographically secured and bound to
the context necessary for the trust decision. In particular, the
key(s) used to sign and/or encrypt the JWT will typically need to
verifiably be under the control of the party identified as the issuer
of the JWT.
<span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. Signing and Encryption Order</span>
While syntactically the signing and encryption operations for Nested
JWTs may be applied in any order, if both signing and encryption are
necessary, normally producers should sign the message and then
<span class="grey">Jones, et al. Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
encrypt the result (thus encrypting the signature). This prevents
attacks in which the signature is stripped, leaving just an encrypted
message, as well as providing privacy for the signer. Furthermore,
signatures over encrypted text are not considered valid in many
jurisdictions.
Note that potential concerns about security issues related to the
order of signing and encryption operations are already addressed by
the underlying JWS and JWE specifications; in particular, because JWE
only supports the use of authenticated encryption algorithms,
cryptographic concerns about the potential need to sign after
encryption that apply in many contexts do not apply to this
specification.
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Privacy Considerations</span>
A JWT may contain privacy-sensitive information. When this is the
case, measures MUST be taken to prevent disclosure of this
information to unintended parties. One way to achieve this is to use
an encrypted JWT and authenticate the recipient. Another way is to
ensure that JWTs containing unencrypted privacy-sensitive information
are only transmitted using protocols utilizing encryption that
support endpoint authentication, such as Transport Layer Security
(TLS). Omitting privacy-sensitive information from a JWT is the
simplest way of minimizing privacy issues.
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. References</span>
<span class="h3"><a class="selflink" id="section-13.1" href="#section-13.1">13.1</a>. Normative References</span>
[<a id="ref-ECMAScript">ECMAScript</a>]
Ecma International, "ECMAScript Language Specification,
5.1 Edition", ECMA Standard 262, June 2011,
<<a href="http://www.ecma-international.org/ecma-262/5.1/ECMA-262.pdf">http://www.ecma-international.org/ecma-262/5.1/</a>
<a href="http://www.ecma-international.org/ecma-262/5.1/ECMA-262.pdf">ECMA-262.pdf</a>>.
[<a id="ref-IANA.MediaTypes">IANA.MediaTypes</a>]
IANA, "Media Types",
<<a href="http://www.iana.org/assignments/media-types">http://www.iana.org/assignments/media-types</a>>.
[<a id="ref-JWA">JWA</a>] Jones, M., "JSON Web Algorithms (JWA)", <a href="./rfc7518">RFC 7518</a>,
DOI 10.17487/RFC7518, May 2015,
<<a href="http://www.rfc-editor.org/info/rfc7518">http://www.rfc-editor.org/info/rfc7518</a>>.
[<a id="ref-JWE">JWE</a>] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)",
<a href="./rfc7516">RFC 7516</a>, DOI 10.17487/RFC7516, May 2015,
<<a href="http://www.rfc-editor.org/info/rfc7516">http://www.rfc-editor.org/info/rfc7516</a>>.
<span class="grey">Jones, et al. Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
[<a id="ref-JWS">JWS</a>] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
Signature (JWS)", <a href="./rfc7515">RFC 7515</a>, DOI 10.17487/RFC, May 2015,
<<a href="http://www.rfc-editor.org/info/rfc7515">http://www.rfc-editor.org/info/rfc7515</a>>.
[<a id="ref-RFC20">RFC20</a>] Cerf, V., "ASCII format for Network Interchange", STD 80,
<a href="./rfc20">RFC 20</a>, DOI 10.17487/RFC0020, October 1969,
<<a href="http://www.rfc-editor.org/info/rfc20">http://www.rfc-editor.org/info/rfc20</a>>.
[<a id="ref-RFC2046">RFC2046</a>] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", <a href="./rfc2046">RFC 2046</a>,
DOI 10.17487/RFC2046, November 1996,
<<a href="http://www.rfc-editor.org/info/rfc2046">http://www.rfc-editor.org/info/rfc2046</a>>.
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="http://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC3986">RFC3986</a>] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66,
<a href="./rfc3986">RFC 3986</a>, DOI 10.17487/RFC3986, January 2005,
<<a href="http://www.rfc-editor.org/info/rfc3986">http://www.rfc-editor.org/info/rfc3986</a>>.
[<a id="ref-RFC4949">RFC4949</a>] Shirey, R., "Internet Security Glossary, Version 2",
FYI 36, <a href="./rfc4949">RFC 4949</a>, DOI 10.17487/RFC4949, August 2007,
<<a href="http://www.rfc-editor.org/info/rfc4949">http://www.rfc-editor.org/info/rfc4949</a>>.
[<a id="ref-RFC7159">RFC7159</a>] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", <a href="./rfc7159">RFC 7159</a>, DOI 10.17487/RFC7159, March
2014, <<a href="http://www.rfc-editor.org/info/rfc7159">http://www.rfc-editor.org/info/rfc7159</a>>.
[<a id="ref-UNICODE">UNICODE</a>] The Unicode Consortium, "The Unicode Standard",
<<a href="http://www.unicode.org/versions/latest/">http://www.unicode.org/versions/latest/</a>>.
<span class="h3"><a class="selflink" id="section-13.2" href="#section-13.2">13.2</a>. Informative References</span>
[<a id="ref-CanvasApp">CanvasApp</a>]
Facebook, "Canvas Applications", 2010,
<<a href="http://developers.facebook.com/docs/authentication/canvas">http://developers.facebook.com/docs/authentication/</a>
<a href="http://developers.facebook.com/docs/authentication/canvas">canvas</a>>.
[<a id="ref-JSS">JSS</a>] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign",
September 2010, <<a href="http://jsonenc.info/jss/1.0/">http://jsonenc.info/jss/1.0/</a>>.
<span class="grey">Jones, et al. Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
[<a id="ref-MagicSignatures">MagicSignatures</a>]
Panzer, J., Ed., Laurie, B., and D. Balfanz, "Magic
Signatures", January 2011,
<<a href="http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-01.html">http://salmon-protocol.googlecode.com/svn/</a>
<a href="http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-01.html">trunk/draft-panzer-magicsig-01.html</a>>.
[<a id="ref-OASIS.saml-core-2.0-os">OASIS.saml-core-2.0-os</a>]
Cantor, S., Kemp, J., Philpott, R., and E. Maler,
"Assertions and Protocols for the OASIS Security Assertion
Markup Language (SAML) V2.0", OASIS Standard
saml-core-2.0-os, March 2005,
<<a href="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">http://docs.oasis-open.org/security/saml/v2.0/</a>
<a href="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">saml-core-2.0-os.pdf</a>>.
[<a id="ref-POSIX.1">POSIX.1</a>] IEEE, "The Open Group Base Specifications Issue 7", IEEE
Std 1003.1, 2013 Edition, 2013,
<<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15">http://pubs.opengroup.org/onlinepubs/9699919799/</a>
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15">basedefs/V1_chap04.html#tag_04_15</a>>.
[<a id="ref-RFC3275">RFC3275</a>] Eastlake 3rd, D., Reagle, J., and D. Solo, "(Extensible
Markup Language) XML-Signature Syntax and Processing",
<a href="./rfc3275">RFC 3275</a>, DOI 10.17487/RFC3275, March 2002,
<<a href="http://www.rfc-editor.org/info/rfc3275">http://www.rfc-editor.org/info/rfc3275</a>>.
[<a id="ref-RFC3339">RFC3339</a>] Klyne, G. and C. Newman, "Date and Time on the Internet:
Timestamps", <a href="./rfc3339">RFC 3339</a>, DOI 10.17487/RFC3339, July 2002,
<<a href="http://www.rfc-editor.org/info/rfc3339">http://www.rfc-editor.org/info/rfc3339</a>>.
[<a id="ref-RFC4122">RFC4122</a>] Leach, P., Mealling, M., and R. Salz, "A Universally
Unique IDentifier (UUID) URN Namespace", <a href="./rfc4122">RFC 4122</a>,
DOI 10.17487/RFC4122, July 2005,
<<a href="http://www.rfc-editor.org/info/rfc4122">http://www.rfc-editor.org/info/rfc4122</a>>.
[<a id="ref-RFC5226">RFC5226</a>] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", <a href="https://www.rfc-editor.org/bcp/bcp26">BCP 26</a>, <a href="./rfc5226">RFC 5226</a>,
DOI 10.17487/RFC5226, May 2008,
<<a href="http://www.rfc-editor.org/info/rfc5226">http://www.rfc-editor.org/info/rfc5226</a>>.
[<a id="ref-RFC6755">RFC6755</a>] Campbell, B. and H. Tschofenig, "An IETF URN Sub-Namespace
for OAuth", <a href="./rfc6755">RFC 6755</a>, DOI 10.17487/RFC6755, October 2012,
<<a href="http://www.rfc-editor.org/info/rfc6755">http://www.rfc-editor.org/info/rfc6755</a>>.
[<a id="ref-RFC6838">RFC6838</a>] Freed, N., Klensin, J., and T. Hansen, "Media Type
Specifications and Registration Procedures", <a href="https://www.rfc-editor.org/bcp/bcp13">BCP 13</a>,
<a href="./rfc6838">RFC 6838</a>, DOI 10.17487/RFC6838, January 2013,
<<a href="http://www.rfc-editor.org/info/rfc6838">http://www.rfc-editor.org/info/rfc6838</a>>.
<span class="grey">Jones, et al. Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
[<a id="ref-SWT">SWT</a>] Hardt, D. and Y. Goland, "Simple Web Token (SWT)", Version
0.9.5.1, November 2009, <<a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh781551.aspx">http://msdn.microsoft.com/en-us/</a>
<a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh781551.aspx">library/windowsazure/hh781551.aspx</a>>.
[<a id="ref-W3C.CR-xml11-20060816">W3C.CR-xml11-20060816</a>]
Cowan, J., "Extensible Markup Language (XML) 1.1 (Second
Edition)", World Wide Web Consortium Recommendation
REC-xml11-20060816, August 2006,
<<a href="http://www.w3.org/TR/2006/REC-xml11-20060816">http://www.w3.org/TR/2006/REC-xml11-20060816</a>>.
[<a id="ref-W3C.REC-xml-c14n-20010315">W3C.REC-xml-c14n-20010315</a>]
Boyer, J., "Canonical XML Version 1.0", World Wide Web
Consortium Recommendation REC-xml-c14n-20010315, March
2001, <<a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</a>>.
<span class="grey">Jones, et al. Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. JWT Examples</span>
This section contains examples of JWTs. For other example JWTs, see
<a href="#section-6.1">Section 6.1</a> of this document and Appendices A.1 - A.3 of [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>].
<span class="h3"><a class="selflink" id="appendix-A.1" href="#appendix-A.1">A.1</a>. Example Encrypted JWT</span>
This example encrypts the same claims as used in <a href="#section-3.1">Section 3.1</a> to the
recipient using RSAES-PKCS1-v1_5 and AES_128_CBC_HMAC_SHA_256.
The following example JOSE Header declares that:
o The Content Encryption Key is encrypted to the recipient using the
RSAES-PKCS1-v1_5 algorithm to produce the JWE Encrypted Key.
o Authenticated encryption is performed on the plaintext using the
AES_128_CBC_HMAC_SHA_256 algorithm to produce the JWE Ciphertext
and the JWE Authentication Tag.
{"alg":"RSA1_5","enc":"A128CBC-HS256"}
Other than using the octets of the UTF-8 representation of the JWT
Claims Set from <a href="#section-3.1">Section 3.1</a> as the plaintext value, the computation
of this JWT is identical to the computation of the JWE in
<a href="#appendix-A.2">Appendix A.2</a> of [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>], including the keys used.
The final result in this example (with line breaks for display
purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
QR1Owv2ug2WyPBnbQrRARTeEk9kDO2w8qDcjiHnSJflSdv1iNqhWXaKH4MqAkQtM
oNfABIPJaZm0HaA415sv3aeuBWnD8J-Ui7Ah6cWafs3ZwwFKDFUUsWHSK-IPKxLG
TkND09XyjORj_CHAgOPJ-Sd8ONQRnJvWn_hXV1BNMHzUjPyYwEsRhDhzjAD26ima
sOTsgruobpYGoQcXUwFDn7moXPRfDE8-NoQX7N7ZYMmpUDkR-Cx9obNGwJQ3nM52
YCitxoQVPzjbl7WBuB7AohdBoZOdZ24WlN1lVIeh8v1K4krB8xgKvRU8kgFrEn_a
1rZgN5TiysnmzTROF869lQ.
AxY8DCtDaGlsbGljb3RoZQ.
MKOle7UQrG6nSxTLX6Mqwt0orbHvAKeWnDYvpIAeZ72deHxz3roJDXQyhxx0wKaM
HDjUEOKIwrtkHthpqEanSBNYHZgmNOV7sln1Eu9g3J8.
fiK51VwhsxJ-siBMR-YFiA
<span class="h3"><a class="selflink" id="appendix-A.2" href="#appendix-A.2">A.2</a>. Example Nested JWT</span>
This example shows how a JWT can be used as the payload of a JWE or
JWS to create a Nested JWT. In this case, the JWT Claims Set is
first signed, and then encrypted.
<span class="grey">Jones, et al. Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
The inner signed JWT is identical to the example in <a href="#appendix-A.2">Appendix A.2</a> of
[<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>]. Therefore, its computation is not repeated here. This
example then encrypts this inner JWT to the recipient using
RSAES-PKCS1-v1_5 and AES_128_CBC_HMAC_SHA_256.
The following example JOSE Header declares that:
o The Content Encryption Key is encrypted to the recipient using the
RSAES-PKCS1-v1_5 algorithm to produce the JWE Encrypted Key.
o Authenticated encryption is performed on the plaintext using the
AES_128_CBC_HMAC_SHA_256 algorithm to produce the JWE Ciphertext
and the JWE Authentication Tag.
o The plaintext is itself a JWT.
{"alg":"RSA1_5","enc":"A128CBC-HS256","cty":"JWT"}
Base64url encoding the octets of the UTF-8 representation of the JOSE
Header yields this encoded JOSE Header value:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldUIn0
The computation of this JWT is identical to the computation of the
JWE in <a href="#appendix-A.2">Appendix A.2</a> of [<a href="#ref-JWE" title=""JSON Web Encryption (JWE)"">JWE</a>], other than that different JOSE Header,
plaintext, JWE Initialization Vector, and Content Encryption Key
values are used. (The RSA key used is the same.)
The plaintext used is the octets of the ASCII [<a href="./rfc20" title=""ASCII format for Network Interchange"">RFC20</a>] representation
of the JWT at the end of <a href="#appendix-A.2.1">Appendix A.2.1</a> of [<a href="#ref-JWS" title=""JSON Web Signature (JWS)"">JWS</a>] (with all whitespace
and line breaks removed), which is a sequence of 458 octets.
The JWE Initialization Vector value used (using JSON array notation)
is:
[82, 101, 100, 109, 111, 110, 100, 32, 87, 65, 32, 57, 56, 48, 53,
50]
This example uses the Content Encryption Key represented by the
base64url-encoded value below:
GawgguFyGrWKav7AX4VKUg
<span class="grey">Jones, et al. Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
The final result for this Nested JWT (with line breaks for display
purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiY3R5IjoiSldU
In0.
g_hEwksO1Ax8Qn7HoN-BVeBoa8FXe0kpyk_XdcSmxvcM5_P296JXXtoHISr_DD_M
qewaQSH4dZOQHoUgKLeFly-9RI11TG-_Ge1bZFazBPwKC5lJ6OLANLMd0QSL4fYE
b9ERe-epKYE3xb2jfY1AltHqBO-PM6j23Guj2yDKnFv6WO72tteVzm_2n17SBFvh
DuR9a2nHTE67pe0XGBUS_TK7ecA-iVq5COeVdJR4U4VZGGlxRGPLRHvolVLEHx6D
YyLpw30Ay9R6d68YCLi9FYTq3hIXPK_-dmPlOUlKvPr1GgJzRoeC9G5qCvdcHWsq
JGTO_z3Wfo5zsqwkxruxwA.
UmVkbW9uZCBXQSA5ODA1Mg.
VwHERHPvCNcHHpTjkoigx3_ExK0Qc71RMEParpatm0X_qpg-w8kozSjfNIPPXiTB
BLXR65CIPkFqz4l1Ae9w_uowKiwyi9acgVztAi-pSL8GQSXnaamh9kX1mdh3M_TT
-FZGQFQsFhu0Z72gJKGdfGE-OE7hS1zuBD5oEUfk0Dmb0VzWEzpxxiSSBbBAzP10
l56pPfAtrjEYw-7ygeMkwBl6Z_mLS6w6xUgKlvW6ULmkV-uLC4FUiyKECK4e3WZY
Kw1bpgIqGYsw2v_grHjszJZ-_I5uM-9RA8ycX9KqPRp9gc6pXmoU_-27ATs9XCvr
ZXUtK2902AUzqpeEUJYjWWxSNsS-r1TJ1I-FMJ4XyAiGrfmo9hQPcNBYxPz3GQb2
8Y5CLSQfNgKSGt0A4isp1hBUXBHAndgtcslt7ZoQJaKe_nNJgNliWtWpJ_ebuOpE
l8jdhehdccnRMIwAmU1n7SPkmhIl1HlSOpvcvDfhUN5wuqU955vOBvfkBOh5A11U
zBuo2WlgZ6hYi9-e3w29bR0C2-pp3jbqxEDw3iWaf2dc5b-LnR0FEYXvI_tYk5rd
_J9N0mg0tQ6RbpxNEMNoA9QWk5lgdPvbh9BaO195abQ.
AVO9iT5AV4CzvDJCdhSFlQ
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Relationship of JWTs to SAML Assertions</span>
Security Assertion Markup Language (SAML) 2.0
[<a href="#ref-OASIS.saml-core-2.0-os">OASIS.saml-core-2.0-os</a>] provides a standard for creating security
tokens with greater expressivity and more security options than
supported by JWTs. However, the cost of this flexibility and
expressiveness is both size and complexity. SAML's use of XML
[<a href="#ref-W3C.CR-xml11-20060816">W3C.CR-xml11-20060816</a>] and XML Digital Signature (DSIG) [<a href="./rfc3275" title=""(Extensible Markup Language) XML-Signature Syntax and Processing"">RFC3275</a>]
contributes to the size of SAML Assertions; its use of XML and
especially XML Canonicalization [<a href="#ref-W3C.REC-xml-c14n-20010315">W3C.REC-xml-c14n-20010315</a>]
contributes to their complexity.
JWTs are intended to provide a simple security token format that is
small enough to fit into HTTP headers and query arguments in URIs.
It does this by supporting a much simpler token model than SAML and
using the JSON [<a href="./rfc7159" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC7159</a>] object encoding syntax. It also supports
securing tokens using Message Authentication Codes (MACs) and digital
signatures using a smaller (and less flexible) format than XML DSIG.
Therefore, while JWTs can do some of the things SAML Assertions do,
JWTs are not intended as a full replacement for SAML Assertions, but
rather as a token format to be used when ease of implementation or
compactness are considerations.
<span class="grey">Jones, et al. Standards Track [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
SAML Assertions are always statements made by an entity about a
subject. JWTs are often used in the same manner, with the entity
making the statements being represented by the "iss" (issuer) claim,
and the subject being represented by the "sub" (subject) claim.
However, with these claims being optional, other uses of the JWT
format are also permitted.
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Relationship of JWTs to Simple Web Tokens (SWTs)</span>
Both JWTs and SWTs [<a href="#ref-SWT" title=""Simple Web Token (SWT)"">SWT</a>], at their core, enable sets of claims to be
communicated between applications. For SWTs, both the claim names
and claim values are strings. For JWTs, while claim names are
strings, claim values can be any JSON type. Both token types offer
cryptographic protection of their content: SWTs with HMAC SHA-256 and
JWTs with a choice of algorithms, including signature, MAC, and
encryption algorithms.
Acknowledgements
The authors acknowledge that the design of JWTs was intentionally
influenced by the design and simplicity of SWTs [<a href="#ref-SWT" title=""Simple Web Token (SWT)"">SWT</a>] and ideas for
JSON tokens that Dick Hardt discussed within the OpenID community.
Solutions for signing JSON content were previously explored by Magic
Signatures [<a href="#ref-MagicSignatures">MagicSignatures</a>], JSON Simple Sign [<a href="#ref-JSS" title=""JSON Simple Sign"">JSS</a>], and Canvas
Applications [<a href="#ref-CanvasApp">CanvasApp</a>], all of which influenced this document.
This specification is the work of the OAuth working group, which
includes dozens of active and dedicated participants. In particular,
the following individuals contributed ideas, feedback, and wording
that influenced this specification:
Dirk Balfanz, Richard Barnes, Brian Campbell, Alissa Cooper, Breno de
Medeiros, Stephen Farrell, Yaron Y. Goland, Dick Hardt, Joe
Hildebrand, Jeff Hodges, Edmund Jay, Warren Kumari, Ben Laurie, Barry
Leiba, Ted Lemon, James Manger, Prateek Mishra, Kathleen Moriarty,
Tony Nadalin, Axel Nennker, John Panzer, Emmanuel Raviart, David
Recordon, Eric Rescorla, Jim Schaad, Paul Tarjan, Hannes Tschofenig,
Sean Turner, and Tom Yu.
Hannes Tschofenig and Derek Atkins chaired the OAuth working group
and Sean Turner, Stephen Farrell, and Kathleen Moriarty served as
Security Area Directors during the creation of this specification.
<span class="grey">Jones, et al. Standards Track [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc7519">RFC 7519</a> JSON Web Token (JWT) May 2015</span>
Authors' Addresses
Michael B. Jones
Microsoft
EMail: mbj@microsoft.com
URI: <a href="http://self-issued.info/">http://self-issued.info/</a>
John Bradley
Ping Identity
EMail: ve7jtb@ve7jtb.com
URI: <a href="http://www.thread-safe.com/">http://www.thread-safe.com/</a>
Nat Sakimura
Nomura Research Institute
EMail: n-sakimura@nri.co.jp
URI: <a href="http://nat.sakimura.org/">http://nat.sakimura.org/</a>
Jones, et al. Standards Track [Page 30]
</pre>
|