本文整理了Java中com.auth0.jwt.interfaces.Verification.acceptExpiresAt()
方法的一些代码示例,展示了Verification.acceptExpiresAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Verification.acceptExpiresAt()
方法的具体详情如下:
包路径:com.auth0.jwt.interfaces.Verification
类名称:Verification
方法名:acceptExpiresAt
暂无
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldValidateExpiresAtWithLeeway() throws Exception {
Clock clock = mock(Clock.class);
when(clock.getToday()).thenReturn(new Date(DATE_TOKEN_MS_VALUE + 1000));
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0Nzc1OTJ9.isvT0Pqx0yjnZk53mUFSeYFJLDs-Ls9IsNAm86gIdZo";
JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWTVerifier.init(Algorithm.HMAC256("secret"))
.acceptExpiresAt(2);
DecodedJWT jwt = verification
.build(clock)
.verify(token);
assertThat(jwt, is(notNullValue()));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldThrowOnNegativeExpiresAtLeeway() throws Exception {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("Leeway value can't be negative.");
Algorithm algorithm = mock(Algorithm.class);
JWTVerifier.init(algorithm)
.acceptExpiresAt(-1);
}
代码示例来源:origin: auth0/java-jwt
@SuppressWarnings("RedundantCast")
@Test
public void shouldOverrideDefaultExpiresAtLeeway() throws Exception {
Algorithm algorithm = mock(Algorithm.class);
JWTVerifier verifier = JWTVerifier.init(algorithm)
.acceptLeeway(1234L)
.acceptExpiresAt(9999L)
.build();
assertThat(verifier.claims, is(notNullValue()));
assertThat(verifier.claims, hasEntry("iat", (Object) 1234L));
assertThat(verifier.claims, hasEntry("exp", (Object) 9999L));
assertThat(verifier.claims, hasEntry("nbf", (Object) 1234L));
}
代码示例来源:origin: com.microsoft.bot.connector/bot-connector
if (!tokenValidationParameters.validateLifetime) {
verification = verification
.acceptExpiresAt(System.currentTimeMillis() + 500)
.acceptNotBefore(0);
内容来源于网络,如有侵权,请联系作者删除!