use of org.gluu.oxauth.model.jwt.JwtClaims in project oxAuth by GluuFederation.
the class JwkRestWebServiceEmbeddedTest method setClaimTestInt.
@Test
public void setClaimTestInt() {
try {
JwtClaims claims = new JwtClaims();
claims.setClaim("test_claim", 123);
assertEquals("{\"test_claim\":123}", claims.toJsonObject().toString());
} catch (Exception ex) {
fail(ex.getMessage());
}
}
use of org.gluu.oxauth.model.jwt.JwtClaims in project oxAuth by GluuFederation.
the class JwkRestWebServiceEmbeddedTest method setClaimTestStringList.
@Test
public void setClaimTestStringList() {
try {
JwtClaims claims = new JwtClaims();
claims.setClaim("test_claim", Arrays.asList("qwe", "asd", "zxc"));
assertEquals("{\"test_claim\":[\"qwe\",\"asd\",\"zxc\"]}", claims.toJsonObject().toString());
} catch (Exception ex) {
fail(ex.getMessage());
}
}
use of org.gluu.oxauth.model.jwt.JwtClaims in project oxAuth by GluuFederation.
the class AudienceTest method addAudience_callItTwiceWithSameValue_shouldResultInSingleAudValue.
@Test
public void addAudience_callItTwiceWithSameValue_shouldResultInSingleAudValue() {
JwtClaims claims = new JwtClaims();
claims.addAudience("aud1");
claims.addAudience("aud1");
assertEquals(claims.getClaimAsString("aud"), "aud1");
}
use of org.gluu.oxauth.model.jwt.JwtClaims in project oxAuth by GluuFederation.
the class AudienceTest method addAudience_callItTwiceWithDifferentValues_shouldResultInSingleAudValue.
@Test
public void addAudience_callItTwiceWithDifferentValues_shouldResultInSingleAudValue() {
JwtClaims claims = new JwtClaims();
claims.addAudience("aud1");
claims.addAudience("aud2");
assertEquals(claims.getClaim("aud"), Lists.newArrayList("aud1", "aud2"));
}
use of org.gluu.oxauth.model.jwt.JwtClaims in project oxAuth by GluuFederation.
the class AudienceTest method setAudience_withAdditionalClaims_shouldResultInAdditionalClaimsPresentinAud.
@Test
public void setAudience_withAdditionalClaims_shouldResultInAdditionalClaimsPresentinAud() {
JwtClaims claims = new JwtClaims();
Client client = new Client();
client.setClientId("clientId");
client.getAttributes().setAdditionalAudience(Lists.newArrayList("aud1", "aud2"));
Audience.setAudience(claims, client);
assertEquals(claims.getClaim("aud"), Lists.newArrayList("clientId", "aud1", "aud2"));
}
Aggregations