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
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -274,6 +274,7 @@ When creating a Token with the `JWT.create()` you can specify a custom Claim by
274
274
```java
275
275
JWT.create()
276
276
.withClaim("name", 123)
277
+
.withArrayClaim("array", newInteger[]{1, 2, 3})
277
278
.sign(Algorithm.HMAC256("secret"));
278
279
```
279
280
@@ -282,11 +283,12 @@ You can also verify custom Claims on the `JWT.require()` by calling `withClaim()
282
283
```java
283
284
JWT.require(Algorithm.HMAC256("secret"))
284
285
.withClaim("name", 123)
286
+
.withArrayClaim("array", 1, 2, 3)
285
287
.build()
286
288
.verify("my.jwt.token");
287
289
```
288
290
289
-
> Currently supported classes for custom Claim verification are: Boolean, Integer, Double, String, Date and Array of types String and Integer.
291
+
> Currently supported classes for custom JWT Claim creation and verification are: Boolean, Integer, Double, String, Date and Arrays of type String and Integer.
290
292
291
293
292
294
### Claim Class
@@ -299,7 +301,7 @@ The Claim class is a wrapper for the Claim values. It allows you to get the Clai
299
301
***asString()**: Returns the String value or null if it can't be converted.
300
302
***asDate()**: Returns the Date value or null if it can't be converted. This must be a NumericDate (Unix Epoch/Timestamp). Note that the [JWT Standard](https://tools.ietf.org/html/rfc7519#section-2) specified that all the *NumericDate* values must be in seconds.
301
303
302
-
#### Custom Class and Collections
304
+
#### Custom Classes and Collections
303
305
To obtain a Claim as a Collection you'll need to provide the **Class Type** of the contents to convert from.
304
306
305
307
***as(class)**: Returns the value parsed as **Class Type**. For collections you should use the `asArray` and `asList` methods.
0 commit comments