JwtHelper { public static final boolean isExpired(final String token, final int allowedClockSkewSeconds) { final Instant now = Instant.now().minus(Duration.ofSeconds(allowedClockSkewSeconds)); return isExpired(token, now); } protected  JwtHelper(final Vertx vertx); final Duration getTokenLifetime(); static final boolean isExpired(final String token, final int allowedClockSkewSeconds); static final boolean isExpired(final String token, final Instant now); static final Date getExpiration(final String token);  }
@Test public void testIsExpired() { final SecretKey key = Keys.hmacShaKeyFor(secret); final String token = Jwts.builder() .signWith(key, SignatureAlgorithm.HS256) .setExpiration(Date.from(Instant.now().minus(Duration.ofSeconds(10)))) .compact(); assertTrue(JwtHelper.isExpired(token, 10)); assertFalse(JwtHelper.isExpired(token, 15)); }