List of usage examples for java.sql Date toInstant
@Override
public Instant toInstant()
From source file:io.cfp.auth.service.TokenService.java
/** * Check if token is valid/*from www . j a v a 2s .co m*/ * @param token * @return */ public boolean isValid(String token) { try { java.util.Date expiration = Jwts.parser().setSigningKey(signingKey).parseClaimsJws(token).getBody() .getExpiration(); if (expiration == null) return false; return expiration.toInstant().isAfter(Instant.now()); } catch (ExpiredJwtException | UnsupportedJwtException | SignatureException | MalformedJwtException | IllegalArgumentException e) { return false; } }