Skip to content

Commit 4d40a1f

Browse files
committed
Add token revocation note and example to authentication docs
1 parent 0cfe707 commit 4d40a1f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

content/en/docs/reference/access-authn-authz/authentication.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,17 @@ jwt:
485485
- expression: "user.groups.all(group, !group.startsWith('system:'))"
486486
message: 'groups cannot used reserved system: prefix'
487487
```
488+
### Token Revocation
488489

490+
Kubernetes does not currently support full token revocation for authentication tokens. To mitigate this, use short-lived tokens to reduce the risk of compromised tokens being used for an extended period. As an alternative, you can approximate revocation by writing user validation rules using Common Expression Language (CEL). For example, you can use the `jti` claim (if present) or any unique token identifier to check against a denylist or revocation list. Note that managing revocation this way can be complex and may not scale well for large systems.
491+
492+
Example of a revocation rule using the `jti` claim:
493+
494+
```yaml
495+
userValidationRules:
496+
# This rule expects the jti claim to be present in the token and checks that the credential ID is not in the denylist
497+
- expression: `has(user.extra.authentication__dot__x__dash__kubernetes__dot__io__slash__credential__dash__id) && !(user.extra.authentication__dot__x__dash__kubernetes__dot__io__slash__credential__dash__id[0] in ["JTI=e28ed49-2e11-4280-9ec5-bc3d1d84661a"])`
498+
message: "credential id is revoked"
489499
* Claim validation rule expression
490500

491501
`jwt.claimValidationRules[i].expression` represents the expression which will be evaluated by CEL.

0 commit comments

Comments
 (0)