Skip to content

Commit

Permalink
Explicit jackson serializer for jwt token provider (#7580)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassaldanha authored Oct 6, 2023
1 parent e368e7b commit f5dca23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ethereum/executionclient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {
implementation 'io.jsonwebtoken:jjwt-api'

runtimeOnly 'io.jsonwebtoken:jjwt-impl'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson'
implementation 'io.jsonwebtoken:jjwt-jackson'

testImplementation testFixtures(project(':infrastructure:async'))
testImplementation testFixtures(project(':infrastructure:time'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.jackson.io.JacksonSerializer;
import java.time.Instant;
import java.util.Date;
import java.util.Optional;
Expand All @@ -35,6 +36,7 @@ public Optional<Token> token(final UInt64 instantInMillis) {
Jwts.builder()
.setIssuedAt(Date.from(Instant.ofEpochMilli(instantInMillis.longValue())))
.signWith(jwtConfig.getKey(), SignatureAlgorithm.HS256)
.serializeToJsonWith(new JacksonSerializer<>())
.compact();
return Optional.of(new Token(jwtToken, expiry));
}
Expand Down

0 comments on commit f5dca23

Please sign in to comment.