|
3 | 3 |
|
4 | 4 | <div class="jwt-decoder-page">
|
5 | 5 | <h2 id="jwt-decoder" style="scroll-margin-top: 3em;">JSON Web Token (JWT) Decoder</h2>
|
6 |
| - <p class="lead"> |
7 |
| - Using this tool, you can decode and validate JSON Web Tokens (JWTs) issued by IdentityServer or another token issuer. |
8 |
| - </p> |
9 |
| - <p> |
10 |
| - A JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. |
11 |
| - It is commonly used for authentication and information exchange in web applications. |
12 |
| - A JWT consists of three parts: a header, a payload, and a signature, separated by dots. |
13 |
| - <br /> |
14 |
| - <br /> |
15 |
| - For more details, see <a href="https://datatracker.ietf.org/doc/html/rfc7519" target="_blank">RFC 7519</a>. |
16 |
| - </p> |
| 6 | + <div id="intro"> |
| 7 | + <p class="lead"> |
| 8 | + Using this tool, you can decode and validate JSON Web Tokens (JWTs) issued by IdentityServer or another token issuer. |
| 9 | + </p> |
| 10 | + <p> |
| 11 | + A JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. |
| 12 | + It is commonly used for authentication and information exchange in web applications. |
| 13 | + A JWT consists of three parts: a header, a payload, and a signature, separated by dots. |
| 14 | + <br /> |
| 15 | + <br /> |
| 16 | + For more details, see <a href="https://datatracker.ietf.org/doc/html/rfc7519" target="_blank">RFC 7519</a>. |
| 17 | + </p> |
| 18 | + </div> |
17 | 19 | <div class="alert alert-warning d-flex align-items-center">
|
18 | 20 | <i class="glyphicon glyphicon-exclamation-sign" style="font-size: 3em" title="Warning"></i>
|
19 | 21 | <div class="mx-3">
|
|
59 | 61 | <h3>Decoded JWT</h3>
|
60 | 62 | <div class="jwt-decoded-output">
|
61 | 63 | <h4 class="pt-1">Header</h4>
|
62 |
| - <div id="jwt-header" class="jwt-decoded jwt-header bg-dark p-2"> </div> |
| 64 | + <div id="jwt-header" class="jwt-decoded jwt-header bg-dark text-light p-2"> </div> |
63 | 65 | <h4 class="pt-1">Payload</h4>
|
64 |
| - <div id="jwt-payload" class="jwt-decoded jwt-payload bg-dark p-2"> </div> |
| 66 | + <div id="jwt-payload" class="jwt-decoded jwt-payload bg-dark text-light p-2"> </div> |
65 | 67 | <h4 class="pt-1">Signature</h4>
|
66 |
| - <pre id="jwt-signature" class="jwt-decoded jwt-signature bg-dark p-2"> </pre> |
| 68 | + <pre id="jwt-signature" class="jwt-decoded jwt-signature bg-dark text-light p-2"> </pre> |
67 | 69 | <div class="jwt-signature-validation-result alert alert-success align-items-center d-none">
|
68 | 70 | <i class="glyphicon glyphicon-ok-sign" style="font-size: 3em" title="Valid signature"></i>
|
69 | 71 | <div class="result-message mx-3">This JWT has a valid signature.</div>
|
|
290 | 292 | $('.row-jwt').removeClass('align-items-stretch');
|
291 | 293 | $('.col-jwt').removeClass('col-md-6');
|
292 | 294 | $('#jwt-input').parent().removeClass('flex-grow-1');
|
| 295 | + $('#intro').addClass('d-none'); |
293 | 296 | }
|
294 | 297 | else {
|
295 | 298 | $('.row-jwt').addClass('align-items-stretch');
|
296 | 299 | $('.col-jwt').addClass('col-md-6');
|
297 | 300 | $('#jwt-input').parent().addClass('flex-grow-1');
|
| 301 | + $('#intro').removeClass('d-none'); |
298 | 302 | }
|
299 | 303 | }
|
300 | 304 |
|
|
474 | 478 | });
|
475 | 479 | contents.append(`<span class="json-object-end">}${(isLastItem ? '' : ',')}</span>`);
|
476 | 480 | } else if (typeof value === 'string') {
|
477 |
| - const text = JSON.stringify(value) + (isLastItem ? '' : ','); |
| 481 | + const text = JSON.stringify(value); |
478 | 482 | contents.text(text);
|
479 | 483 | contents.addClass('json-string');
|
| 484 | + if (!isLastItem) { |
| 485 | + contents.append('<span class="json-structure">,</span>'); |
| 486 | + } |
480 | 487 | } else if (typeof value === 'number') {
|
481 |
| - const text = value + (isLastItem ? '' : ','); |
| 488 | + const text = value; |
482 | 489 | contents.text(text);
|
483 | 490 | contents.addClass('json-number');
|
| 491 | + if (!isLastItem) { |
| 492 | + contents.append('<span class="json-structure">,</span>'); |
| 493 | + } |
484 | 494 | } else if (typeof value === 'boolean') {
|
485 |
| - const text = (value ? 'true' : 'false') + (isLastItem ? '' : ','); |
| 495 | + const text = value ? 'true' : 'false'; |
486 | 496 | contents.text(text);
|
487 | 497 | contents.addClass('json-boolean');
|
| 498 | + if (!isLastItem) { |
| 499 | + contents.append('<span class="json-structure">,</span>'); |
| 500 | + } |
488 | 501 | } else {
|
489 |
| - const text = String(value) + (isLastItem ? '' : ','); |
| 502 | + const text = String(value); |
490 | 503 | contents.text(text);
|
491 | 504 | contents.addClass('json-unknown');
|
| 505 | + if (!isLastItem) { |
| 506 | + contents.append('<span class="json-structure">,</span>'); |
| 507 | + } |
492 | 508 | }
|
493 | 509 |
|
494 | 510 | if (options.explainClaims && key && explain) {
|
|
0 commit comments