()
| 286 | } |
| 287 | |
| 288 | @Test |
| 289 | public void shouldGetNotBefore() { |
| 290 | long seconds = 1477592; |
| 291 | Clock clock = Clock.fixed(Instant.ofEpochSecond(seconds), ZoneId.of("UTC")); |
| 292 | |
| 293 | String token = "eyJhbGciOiJIUzI1NiJ9.eyJuYmYiOjE0Nzc1OTJ9.mWYSOPoNXstjKbZkKrqgkwPOQWEx3F3gMm6PMcfuJd8"; |
| 294 | JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); |
| 295 | DecodedJWT jwt = verification |
| 296 | .build(clock) |
| 297 | .verify(token); |
| 298 | |
| 299 | assertThat(jwt, is(notNullValue())); |
| 300 | assertThat(jwt.getNotBefore(), is(equalTo(new Date(seconds * 1000)))); |
| 301 | assertThat(jwt.getNotBeforeAsInstant(), is(equalTo(Instant.ofEpochSecond(seconds)))); |
| 302 | } |
| 303 | |
| 304 | @Test |
| 305 | public void shouldGetIssuedAt() { |
nothing calls this directly
no test coverage detected