Closed
Description
Describe the problem
I tried with the code below, but no exception occurred. (TokenExpiredException occurs when Clock
is +1 second)
This means that token lifetime is NOW <= "exp"
// kotlin code
val expiresAt = Instant.now()
val token = JWT.create()
.withExpiresAt(expiresAt)
.sign(Algorithm.HMAC256("test"))
val verifier = (JWT.require(Algorithm.HMAC256("test")) as JWTVerifier.BaseVerification)
.build(Clock.fixed(expiresAt, ZoneId.of("UTC")))
verifier.verify(token)
Shouldn't the token lifetime be NOW < "exp"
?
I think this description is correct.
https://github.com/auth0/java-jwt/blob/master/EXAMPLES.md#datetime-claim-validation
Environment
- Version of this library used: 4.2.1
- Version of Java used: 11
- Other modules/plugins/libraries that might be involved: Kotlin 1.7.22