Skip to content

Commit b042821

Browse files
committed
Add de-serializer configuration so that you can de-serialize this w/ any Jackson ObjectMapper w/out having to register the handlers yourself.
1 parent 4a7eafb commit b042821

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ build
22
*.iws
33
.idea
44
target
5-
.DS_Store
5+
.DS_Store
6+
.savant/cache

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FusionAuth JWT Changes
22

3+
Changes in 5.2.4
4+
5+
* Bind a deserializer using @JsonDeserialize the JWT object for all ZoneDateTime objects. This allows
6+
you to use any Jackson Object Mapper w/out explicitly binding these deserializers.
7+
38
Changes in 5.2.3
49

510
* Upgraded Jackson Core to 2.14.0

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ We are very interested in compensating anyone that can identify a security relat
4141
<dependency>
4242
<groupId>io.fusionauth</groupId>
4343
<artifactId>fusionauth-jwt</artifactId>
44-
<version>5.2.3</version>
44+
<version>5.2.4</version>
4545
</dependency>
4646
```
4747

4848
### Gradle
4949
```groovy
50-
implementation 'io.fusionauth:fusionauth-jwt:5.2.3'
50+
implementation 'io.fusionauth:fusionauth-jwt:5.2.4'
5151
```
5252

5353
### Gradle Kotlin
5454
```kotlin
55-
implementation("io.fusionauth:fusionauth-jwt:5.2.3")
55+
implementation("io.fusionauth:fusionauth-jwt:5.2.4")
5656
```
5757

5858
### Savant
5959
```groovy
60-
dependency(id: "io.fusionauth:fusionauth-jwt:5.2.3")
60+
dependency(id: "io.fusionauth:fusionauth-jwt:5.2.4")
6161
```
6262

6363
For others see [https://search.maven.org](https://search.maven.org/artifact/io.fusionauth/fusionauth-jwt/4.0.1/jar).

build.savant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
jacksonVersion = "2.14.0"
1818

19-
project(group: "io.fusionauth", name: "fusionauth-jwt", version: "5.2.3", licenses: ["ApacheV2_0"]) {
19+
project(group: "io.fusionauth", name: "fusionauth-jwt", version: "5.2.4", licenses: ["ApacheV2_0"]) {
2020

2121
workflow {
2222
fetch {

src/main/java/io/fusionauth/jwt/domain/JWT.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2022, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2016-2023, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,11 +20,13 @@
2020
import com.fasterxml.jackson.annotation.JsonAnySetter;
2121
import com.fasterxml.jackson.annotation.JsonIgnore;
2222
import com.fasterxml.jackson.annotation.JsonProperty;
23+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2324
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
2425
import io.fusionauth.jwt.JWTDecoder;
2526
import io.fusionauth.jwt.JWTEncoder;
2627
import io.fusionauth.jwt.TimeMachineJWTDecoder;
2728
import io.fusionauth.jwt.json.Mapper;
29+
import io.fusionauth.jwt.json.ZonedDateTimeDeserializer;
2830
import io.fusionauth.jwt.json.ZonedDateTimeSerializer;
2931

3032
import java.math.BigDecimal;
@@ -71,6 +73,7 @@ public class JWT {
7173
* processing. The expiration time is expected to provided in UNIX time, or the number of seconds since Epoch.
7274
*/
7375
@JsonProperty("exp")
76+
@JsonDeserialize(using = ZonedDateTimeDeserializer.class)
7477
@JsonSerialize(using = ZonedDateTimeSerializer.class)
7578
public ZonedDateTime expiration;
7679

@@ -81,6 +84,7 @@ public class JWT {
8184
* UNIX time, or the number of seconds since Epoch.
8285
*/
8386
@JsonProperty("iat")
87+
@JsonDeserialize(using = ZonedDateTimeDeserializer.class)
8488
@JsonSerialize(using = ZonedDateTimeSerializer.class)
8589
public ZonedDateTime issuedAt;
8690

@@ -97,9 +101,10 @@ public class JWT {
97101
* Registered Claim <code>nbf</code> as defined by RFC 7519 Section 4.1.5. Use of this claim is OPTIONAL.
98102
* <p>
99103
* This claim identifies the time before which the JWT MUST NOT be accepted for processing. The not before value is
100-
* expected to provided in UNIX time, or the number of seconds since Epoch.
104+
* expected to be provided in UNIX time, or the number of seconds since Epoch.
101105
*/
102106
@JsonProperty("nbf")
107+
@JsonDeserialize(using = ZonedDateTimeDeserializer.class)
103108
@JsonSerialize(using = ZonedDateTimeSerializer.class)
104109
public ZonedDateTime notBefore;
105110

0 commit comments

Comments
 (0)