use of com.auth0.jwt.Claim in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddIntegerClaim.
@Test
public void shouldAddIntegerClaim() {
String token = authBuilder.addClaim("testKey", 42).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asInt()).isEqualTo(42);
}
use of com.auth0.jwt.Claim in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddDoubleClaim.
@Test
public void shouldAddDoubleClaim() {
String token = authBuilder.addClaim("testKey", 3.141D).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asDouble()).isEqualTo(3.141D);
}
use of com.auth0.jwt.Claim in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddStringArrayClaim.
@Test
public void shouldAddStringArrayClaim() {
String token = authBuilder.addClaim("testKey", new String[] { "Hello", "World" }).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asList(String.class)).containsExactly("Hello", "World");
}
use of com.auth0.jwt.Claim in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddBooleanClaim.
@Test
public void shouldAddBooleanClaim() {
String token = authBuilder.addClaim("testKey", true).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asBoolean()).isTrue();
}
use of com.auth0.jwt.Claim in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddLongArrayClaim.
@Test
public void shouldAddLongArrayClaim() {
String token = authBuilder.addClaim("testKey", new Long[] { 1L, 2L }).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asList(Long.class)).containsExactly(1L, 2L);
}
Aggregations