本文整理了Java中com.auth0.jwt.algorithms.Algorithm.none()
方法的一些代码示例,展示了Algorithm.none()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Algorithm.none()
方法的具体详情如下:
包路径:com.auth0.jwt.algorithms.Algorithm
类名称:Algorithm
方法名:none
暂无
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldReturnNullSigningKeyId() throws Exception {
assertThat(Algorithm.none().getSigningKeyId(), is(nullValue()));
}
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldCreateNoneAlgorithm() throws Exception {
Algorithm algorithm = Algorithm.none();
assertThat(algorithm, is(notNullValue()));
assertThat(algorithm, is(instanceOf(NoneAlgorithm.class)));
assertThat(algorithm.getDescription(), is("none"));
assertThat(algorithm.getName(), is("none"));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldPassNoneVerification() throws Exception {
Algorithm algorithm = Algorithm.none();
String jwt = "eyJhbGciOiJub25lIiwiY3R5IjoiSldUIn0.eyJpc3MiOiJhdXRoMCJ9.";
algorithm.verify(JWT.decode(jwt));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldAcceptNoneAlgorithm() throws Exception {
String token = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJhdXRoMCJ9.";
DecodedJWT jwt = JWT.require(Algorithm.none())
.build()
.verify(token);
assertThat(jwt, is(notNullValue()));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldSetEmptySignatureIfAlgorithmIsNone() throws Exception {
String signed = JWTCreator.init()
.sign(Algorithm.none());
assertThat(signed, is(notNullValue()));
assertThat(TokenUtils.splitToken(signed)[2], is(""));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldFailNoneVerificationWhenSignatureIsPresent() throws Exception {
exception.expect(SignatureVerificationException.class);
exception.expectMessage("The Token's Signature resulted invalid when verified using the Algorithm: none");
String jwt = "eyJhbGciOiJub25lIiwiY3R5IjoiSldUIn0.eyJpc3MiOiJhdXRoMCJ9.Ox-WRXRaGAuWt2KfPvWiGcCrPqZtbp_4OnQzZXaTfss";
Algorithm algorithm = Algorithm.none();
algorithm.verify(JWT.decode(jwt));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldFailNoneVerificationWhenTokenHasTwoParts() throws Exception {
exception.expect(JWTDecodeException.class);
exception.expectMessage("The token was expected to have 3 parts, but got 2.");
String jwt = "eyJhbGciOiJub25lIiwiY3R5IjoiSldUIn0.eyJpc3MiOiJhdXRoMCJ9";
Algorithm algorithm = Algorithm.none();
algorithm.verify(JWT.decode(jwt));
}
代码示例来源:origin: mvetsch/JWT4B
return Algorithm.none();
内容来源于网络,如有侵权,请联系作者删除!