xxxxxxxxxx
/**
* This method checks if the current time is greater than or equal to the JWT expiration claim.
* @param jwt A String JSON web token.
* @return True if the jwt token is expired. False if the token is not expired.
*/
public boolean checkIfTokenIsExpired(String jwt) throws InvalidJwtException, MalformedClaimException {
JwtConsumer jwtConsumer = new JwtConsumerBuilder()
.setRequireExpirationTime()
.setSkipDefaultAudienceValidation()
.setDisableRequireSignature()
.setSkipSignatureVerification()
.build();
JwtClaims jwtClaims = jwtConsumer.processToClaims(jwt);
return NumericDate.now().getValue() >= jwtClaims.getExpirationTime().getValue();
}