use of com.auth0.json.mgmt.Token in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldOverwriteClaimOnMultipleAddCalls.
@Test
public void shouldOverwriteClaimOnMultipleAddCalls() {
String token = authBuilder.addClaim("test", 1L).addClaim("test", 2).addClaim("test", "foo").buildToken();
DecodedJWT jwt = JWT.decode(token);
assertThat(jwt.getClaim("test").asLong()).isNull();
assertThat(jwt.getClaim("test").asInt()).isNull();
assertThat(jwt.getClaim("test").asString()).isEqualTo("foo");
}
use of com.auth0.json.mgmt.Token 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.json.mgmt.Token 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.json.mgmt.Token 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);
}
use of com.auth0.json.mgmt.Token in project sda-dropwizard-commons by SDA-SE.
the class AuthBuilderTest method shouldAddIntArrayClaim.
@Test
public void shouldAddIntArrayClaim() {
String token = authBuilder.addClaim("testKey", new Integer[] { 1, 2 }).buildToken();
Claim claim = JWT.decode(token).getClaim("testKey");
assertThat(claim.asList(Integer.class)).containsExactly(1, 2);
}
Aggregations