MCPcopy Index your code
hub / github.com/auth0/java-jwt / shouldGetIssuedAt

Method shouldGetIssuedAt

lib/src/test/java/com/auth0/jwt/JWTTest.java:304–318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

302 }
303
304 @Test
305 public void shouldGetIssuedAt() {
306 long seconds = 1477592;
307 Clock clock = Clock.fixed(Instant.ofEpochSecond(seconds), ZoneId.of("UTC"));
308
309 String token = "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE0Nzc1OTJ9.5o1CKlLFjKKcddZzoarQ37pq7qZqNPav3sdZ_bsZaD4";
310 JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret"));
311 DecodedJWT jwt = verification
312 .build(clock)
313 .verify(token);
314
315 assertThat(jwt, is(notNullValue()));
316 assertThat(jwt.getIssuedAt(), is(equalTo(new Date(seconds * 1000))));
317 assertThat(jwt.getIssuedAtAsInstant(), is(equalTo(Instant.ofEpochSecond(seconds))));
318 }
319
320 @Test
321 public void shouldGetId() {

Callers

nothing calls this directly

Calls 6

requireMethod · 0.95
HMAC256Method · 0.95
verifyMethod · 0.65
buildMethod · 0.65
getIssuedAtMethod · 0.65
getIssuedAtAsInstantMethod · 0.65

Tested by

no test coverage detected