diff --git a/pom.xml b/pom.xml index 1e0e8fb..9a77219 100644 --- a/pom.xml +++ b/pom.xml @@ -29,12 +29,12 @@ 5.3.1 - - 4.4.0 - 3.18.0 + + 0.13.0 + 2.25.3 2.25.3 @@ -255,14 +255,30 @@ - + - + + + io.jsonwebtoken + jjwt-api + ${jjwt.version} + + + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + runtime + + + - com.auth0 - java-jwt - ${java-jwt.version} + io.jsonwebtoken + jjwt-jackson + ${jjwt.version} + runtime diff --git a/src/main/java/apiCalls/Utils/generic/BaseAPI.java b/src/main/java/apiCalls/Utils/generic/BaseAPI.java index 812c644..dda640e 100644 --- a/src/main/java/apiCalls/Utils/generic/BaseAPI.java +++ b/src/main/java/apiCalls/Utils/generic/BaseAPI.java @@ -4,8 +4,7 @@ import activesupport.system.Properties; import apiCalls.Utils.http.RestUtils; import apiCalls.actions.Token; -import com.auth0.jwt.JWT; -import com.auth0.jwt.exceptions.JWTDecodeException; +import io.jsonwebtoken.Jwts; import org.apache.hc.core5.http.HttpException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -44,9 +43,14 @@ public synchronized String adminJWT() throws HttpException { private boolean isTokenExpired(String token) { try { - var decodedJWT = JWT.decode(token); - return decodedJWT.getExpiresAt().before(new Date()); - } catch (JWTDecodeException e) { + var decodedJWT = Jwts.parser() + .unsecured() + .build() + .parseUnsecuredClaims(token) + .getPayload(); + + return decodedJWT.getExpiration().before(new Date()); + } catch (Exception e) { LOGGER.error("Error decoding token: {}", e.getMessage()); return true; }