diff --git a/pom.xml b/pom.xml
index 274012c0b..a630c3964 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,7 @@
5.3.4
4.1.5
4.3.7
- 0.11.5
+ 0.12.2
1.18.30
0.1.2-SNAPSHOT
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java b/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
index db1cfe854..970c286e7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
@@ -73,7 +73,7 @@ public class JwtService {
protected void init() {
secretKey = Base64.getEncoder().encodeToString(secretKey.getBytes());
key = new SecretKeySpec(secretKey.getBytes(), SignatureAlgorithm.HS256.getJcaName());
- parser = Jwts.parserBuilder().setSigningKey(key).build();
+ parser = Jwts.parser().setSigningKey(key).build();
}
public String createToken(AuthDTO authDTO) {
@@ -94,13 +94,13 @@ public Authentication getAuthentication(String token) {
}
public String getUserUuid(String token) {
- return parser.parseClaimsJws(token).getBody().getSubject();
+ return parser.parseClaimsJws(token).getPayload().getSubject();
}
public boolean validateToken(String token) {
try {
final Jws claims = parser.parseClaimsJws(token);
- return !claims.getBody().getExpiration().before(new Date());
+ return !claims.getPayload().getExpiration().before(new Date());
}
catch (JwtException | IllegalArgumentException exception) {
throw new UnauthorizedException("Expired or invalid JWT token");
@@ -108,13 +108,13 @@ public boolean validateToken(String token) {
}
private String buildToken(User user) {
- final Claims claims = Jwts.claims().setSubject(user.getUuid());
+ final Claims claims = Jwts.claims().subject(user.getUuid()).build();
final Date now = new Date();
final Date validity = new Date(now.getTime() + (expiration * DAY_MS));
return Jwts.builder()
- .setClaims(claims)
- .setIssuedAt(now)
- .setExpiration(validity)
+ .claims(claims)
+ .issuedAt(now)
+ .expiration(validity)
.signWith(key)
.compact();
}