You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-8Lines changed: 27 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,33 @@ If the token has an invalid syntax or the header or payload are not JSONs, a `JW
87
87
If the token has an invalid signature or the Claim requirement is not met, a `JWTVerificationException` will raise.
88
88
89
89
90
+
#### Time Validation
91
+
92
+
The JWT token may include DateNumber fields that can be used to validate that:
93
+
* The token was issued in a past date `"iat" < TODAY`
94
+
* The token hasn't expired yet `"exp" > TODAY` and
95
+
* The token can already be used. `"nbf" > TODAY`
96
+
97
+
When verifying a token the time validation occurs automatically, resulting in a `JWTVerificationException` being throw when the values are invalid. If any of the previous fields are missing they won't be considered in this validation.
98
+
99
+
To specify a **delta window** or leeway in which the Token should still be considered valid, use the `acceptTimeDelta()` method in the `JWTVerifier` builder and pass a positive milliseconds value. This applies to every item listed above.
@@ -145,14 +172,6 @@ Returns the JWT ID value or null if it's not defined.
145
172
String id = jwt.getId();
146
173
```
147
174
148
-
#### Time Validation
149
-
150
-
The JWT token may include DateNumber fields that can be used to validate that the token was issued in a past date `"iat" < TODAY` and that the expiration date is in the future `"exp" > TODAY`. This library includes a method that checks both of this fields and returns the validity of the token. If any of the fields is missing they won't be considered.
151
-
152
-
```java
153
-
boolean isExpired = jwt.isExpired();
154
-
```
155
-
156
175
### Private Claims
157
176
158
177
Additional Claims defined in the token can be obtained by calling `getClaim()` and passing the Claim name. A Claim will always be returned, even if it can't be found.
0 commit comments