Skip to content

Commit b609af7

Browse files
committed
modify introduction en doc to handle ids
1 parent e3da084 commit b609af7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/features/introduction/docs/en.introduction.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { MdxAnchorComponent } from "@/features/common/components/markdown/mdx-anchor.component";
22
import { MarkdownImage } from "@/features/common/components/markdown/markdown-image";
33

4-
## What is JSON Web Token?
4+
<h2 id={props.headings[0].id}>{props.headings[0].title}</h2>
55

66
JSON Web Token (JWT) is an open standard (<MdxAnchorComponent type="external" href="https://tools.ietf.org/html/rfc7519">RFC 7519</MdxAnchorComponent>) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the **HMAC** algorithm) or a public/private key pair using **RSA** or **ECDSA**.
77

88
Although JWTs can be encrypted to also provide secrecy between parties, we will focus on *signed* tokens. Signed tokens can verify the *integrity* of the claims contained within it, while encrypted tokens *hide* those claims from other parties. When tokens are signed using public/private key pairs, the signature also certifies that only the party holding the private key is the one that signed it.
99

10-
## When should you use JSON Web Tokens?
10+
<h2 id={props.headings[1].id}>{props.headings[1].title}</h2>
1111
Here are some scenarios where JSON Web Tokens are useful:
1212

1313
- **Authorization**: This is the most common scenario for using JWT. Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays because of its small overhead and its ability to be easily used across different domains.
1414
- **Information Exchange**: JSON Web Tokens are a good way of securely transmitting information between parties. Because JWTs can be signed—for example, using public/private key pairs—you can be sure the senders are who they say they are. Additionally, as the signature is calculated using the header and the payload, you can also verify that the content hasn't been tampered with.
1515

16-
## What is the JSON Web Token structure?
16+
<h2 id={props.headings[2].id}>{props.headings[2].title}</h2>
1717
In its compact form, JSON Web Tokens consist of three parts separated by dots (`.`), which are:
1818

1919
- Header
@@ -93,7 +93,7 @@ If you want to play with JWT and put these concepts into practice, you can use <
9393

9494
<MarkdownImage src="https://cdn.auth0.com/website/jwt/introduction/debugger.png" alt="JWT.io Debugger" />
9595

96-
## How do JSON Web Tokens work?
96+
<h2 id={props.headings[3].id}>{props.headings[3].title}</h2>
9797
In authentication, when the user successfully logs in using their credentials, a JSON Web Token will be returned. Since tokens are credentials, great care must be taken to prevent security issues. In general, you should not keep tokens longer than required.
9898

9999
You also <MdxAnchorComponent type="external" href="https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html#local-storage">should not store sensitive session data in browser storage due to lack of security</MdxAnchorComponent>.
@@ -120,7 +120,7 @@ The following diagram shows how a JWT is obtained and used to access APIs or res
120120

121121
Do note that with signed tokens, all the information contained within the token is exposed to users or other parties, even though they are unable to change it. This means you should not put secret information within the token.
122122

123-
## Why should we use JSON Web Tokens?
123+
<h2 id={props.headings[4].id}>{props.headings[4].title}</h2>
124124

125125
Let's talk about the benefits of **JSON Web Tokens (JWT)** when compared to **Simple Web Tokens (SWT)** and **Security Assertion Markup Language Tokens (SAML)**.
126126

@@ -138,7 +138,7 @@ _Comparison of the length of an encoded JWT and an encoded SAML_
138138

139139
If you want to read more about JSON Web Tokens and even start using them to perform authentication in your own applications, browse to the <MdxAnchorComponent type="external" href="http://auth0.com/learn/json-web-tokens">JSON Web Token landing page</MdxAnchorComponent> at Auth0.
140140

141-
## Difference Between Validating and Verifying a JWT
141+
<h2 id={props.headings[5].id}>{props.headings[5].title}</h2>
142142

143143
JSON Web Token (JWT) validation and verification are crucial for security, but they address slightly different aspects of JWT security: validation ensures the token is well-formed and contains enforceable claims; verification ensures the token is genuine and unmodified.
144144

@@ -165,7 +165,7 @@ You verify a JWT to make sure the token hasn't been altered maliciously and come
165165
In many systems, these steps are often combined into what might be colloquially called "JWT verification" which encompasses both validation and verification for comprehensive security checks. Nonetheless, their distinction remains.
166166

167167

168-
## Difference Between Decoding and Encoding a JWT
168+
<h2 id={props.headings[6].id}>{props.headings[6].title}</h2>
169169

170170
Encoding a JWT involves transforming the header and payload into a compact, URL-safe format. The header, which states the signing algorithm and token type, and the payload, which includes claims like subject, expiration, and issue time, are both converted to JSON then Base64URL encoded. These encoded parts are then concatenated with a dot, after which a signature is generated using the algorithm specified in the header with a secret or private key. This signature is also Base64URL encoded, resulting in the final JWT string that represents the token in a format suitable for transmission or storage.
171171

0 commit comments

Comments
 (0)