Skip to content

Commit 70f81ce

Browse files
patriciasantaanaharshil1712
authored andcommitted
[API Shield] Update JWT Validation fields (#17728)
* update JWTV fields * edits * remove fields * dynamic fields * spacing * feedback updates
1 parent 6bc5d06 commit 70f81ce

File tree

3 files changed

+71
-26
lines changed

3 files changed

+71
-26
lines changed

src/content/docs/api-shield/security/jwt-validation/transform-rules.mdx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,4 @@ As an example, to send the header `x-send-jwt-claim-user` request header to the
3434
4. Enter a rule name and a filter expression, if applicable.
3535
5. Choose **Set dynamic**.
3636
6. Set the header name.
37-
7. Set the value to `lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIGURATION_ID>"][0], "claim_name")`, where `<TOKEN_CONFIGURATION_ID>` is your token configuration ID found in JWT Validation and `claim_name` is the JWT claim you want to add to the header.
38-
39-
## Available fields
40-
41-
You can create Transform Rules using more claims present in tokens processed by [JWT Validation](/api-shield/security/jwt-validation/).
42-
43-
- `http.request.jwt.claims.aud,`
44-
- `http.request.jwt.claims.aud.names,`
45-
- `http.request.jwt.claims.aud.values,`
46-
- `http.request.jwt.claims.iat.sec,`
47-
- `http.request.jwt.claims.iat.sec.names,`
48-
- `http.request.jwt.claims.iat.sec.values,`
49-
- `http.request.jwt.claims.iss,`
50-
- `http.request.jwt.claims.iss.names,`
51-
- `http.request.jwt.claims.iss.values,`
52-
- `http.request.jwt.claims.jti,`
53-
- `http.request.jwt.claims.jti.names,`
54-
- `http.request.jwt.claims.jti.values,`
55-
- `http.request.jwt.claims.nbf.sec,`
56-
- `http.request.jwt.claims.nbf.sec.names,`
57-
- `http.request.jwt.claims.nbf.sec.values,`
58-
- `http.request.jwt.claims.sub,`
59-
- `http.request.jwt.claims.sub.names,`
60-
- `http.request.jwt.claims.sub.values,`
61-
- `cf.api_gateway.auth_id_present,`
62-
- `cf.api_gateway.request_violates_schema`
37+
7. Set the value to `lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIGURATION_ID>"][0], "claim_name")`, where `<TOKEN_CONFIGURATION_ID>` is your token configuration ID found in JWT Validation and `claim_name` is the [JWT claim](/ruleset-engine/rules-language/fields/dynamic-fields/#json-web-tokens-validation-claims) you want to add to the header.

src/content/docs/ruleset-engine/rules-language/fields/dynamic-fields.mdx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,3 +511,67 @@ Identifies whether a request comes from a worker or not. When a request comes fr
511511
## Corporate Proxy
512512

513513
<Render file="corporate_proxy" product="bots" />
514+
515+
## JSON Web Tokens Validation claims
516+
517+
[API Shield](/api-shield/) users can now create [custom rules](/waf/custom-rules/) using claims present in tokens processed by [JSON Web Tokens Validation](/api-shield/security/jwt-validation/).
518+
519+
### `aud` (audience)
520+
521+
`http.request.jwt.claims.aud` `Map<Array<String>>` <br />
522+
`http.request.jwt.claims.aud.names` `Array<String>` <br />
523+
`http.request.jwt.claims.aud.values` `Array<String>` <br />
524+
525+
The `aud` (audience) claim identifies the recipients that the JSON Web Token (JWT) is intended for. Each principal intended to process the JWT must identify itself with a value in the audience claim. In the general case, the `aud` value is an array of case-sensitive strings, each containing a `StringOrURI` value.
526+
527+
<Render file="jwt-claims" product="api-shield" />
528+
529+
### `iat` (issued at)
530+
531+
`http.request.jwt.claims.iat.sec` `Map<Array<Integer>>` <br />
532+
`http.request.jwt.claims.iat.sec.names` `Array<String>` <br />
533+
`http.request.jwt.claims.iat.sec.values` `Array<Integer>` <br />
534+
535+
The `iat` (issued at) claim identifies the time (number of seconds) at which the JWT was issued.
536+
537+
<Render file="jwt-claims" product="api-shield" />
538+
539+
### `iss` (issuer)
540+
541+
`http.request.jwt.claims.iss` `Map<Array<String>>` <br />
542+
`http.request.jwt.claims.iss.names` `Array<String>` <br />
543+
`http.request.jwt.claims.iss.values` `Array<String>` <br />
544+
545+
The `iss` (issuer) claim identifies the principal that issued the JWT.
546+
547+
<Render file="jwt-claims" product="api-shield" />
548+
549+
### `jti` (JWT ID)
550+
551+
`http.request.jwt.claims.jti` `Map<Array<String>>` <br />
552+
`http.request.jwt.claims.jti.names` `Array<String>` <br />
553+
`http.request.jwt.claims.jti.values` `Array<String>` <br />
554+
555+
The `jti` (JWT ID) claim provides a unique identifier for the JWT.
556+
557+
<Render file="jwt-claims" product="api-shield" />
558+
559+
### `nbf` (not before)
560+
561+
`http.request.jwt.claims.nbf.sec` `Map<Array<Integer>>` <br />
562+
`http.request.jwt.claims.nbf.sec.names` `Array<String>` <br />
563+
`http.request.jwt.claims.nbf.sec.values` `Array<Integer>` <br />
564+
565+
The `nbf` (not before) claim identifies the time (number of seconds) before which the JWT must not be accepted for processing.
566+
567+
<Render file="jwt-claims" product="api-shield" />
568+
569+
### `sub` (subject)
570+
571+
`http.request.jwt.claims.sub` `Map<Array<String>>` <br />
572+
`http.request.jwt.claims.sub.names` `Array<String>` <br />
573+
`http.request.jwt.claims.sub.values` `Array<String>` <br />
574+
575+
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.
576+
577+
<Render file="jwt-claims" product="api-shield" />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
{}
3+
4+
---
5+
6+
Refer to the [Registered Claim Names](https://datatracker.ietf.org/doc/html/rfc7519#section-4.1) in RFC 7519 for more information.

0 commit comments

Comments
 (0)