Exemplo n.º 1
0
 @Test
 public void shouldValidateTokenWithLeewayCheck() {
   // given
   final JsonObject jsonObject = new JsonObject();
   jsonObject.addProperty(JWTConstants.EXPIRATION, Instant.now().plusSeconds(7).getEpochSecond());
   // when
   expirationChecker.check(jsonObject);
 }
Exemplo n.º 2
0
 @Test
 public void shouldFailForInvalidTokenValue() {
   // expect
   expectedException.expect(InvalidTokenException.class);
   // given
   final JsonObject jsonObject = new JsonObject();
   // when
   expirationChecker.check(jsonObject);
 }
Exemplo n.º 3
0
 @Test
 public void shouldFailForExpiredToken() {
   // expect
   expectedException.expect(ExpiredTokenException.class);
   // given
   final JsonObject jsonObject = new JsonObject();
   jsonObject.addProperty(JWTConstants.EXPIRATION, Instant.now().minusSeconds(7).getEpochSecond());
   // when
   expirationChecker.check(jsonObject);
 }