本文整理了Java中com.auth0.jwt.interfaces.Verification.withSubject()
方法的一些代码示例,展示了Verification.withSubject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Verification.withSubject()
方法的具体详情如下:
包路径:com.auth0.jwt.interfaces.Verification
类名称:Verification
方法名:withSubject
暂无
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldValidateSubject() throws Exception {
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.Rq8IxqeX7eA6GgYxlcHdPFVRNFFZc5rEI3MQTZZbK3I";
DecodedJWT jwt = JWTVerifier.init(Algorithm.HMAC256("secret"))
.withSubject("1234567890")
.build()
.verify(token);
assertThat(jwt, is(notNullValue()));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldThrowOnInvalidSubject() throws Exception {
exception.expect(InvalidClaimException.class);
exception.expectMessage("The Claim 'sub' value doesn't match the required one.");
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.Rq8IxqeX7eA6GgYxlcHdPFVRNFFZc5rEI3MQTZZbK3I";
JWTVerifier.init(Algorithm.HMAC256("secret"))
.withSubject("invalid")
.build()
.verify(token);
}
代码示例来源:origin: com.github.edgar615/spring-boot-util-jwt
verification.withSubject(jwtProperty.getSubject());
内容来源于网络,如有侵权,请联系作者删除!