Search in sources :

Example 1 with JwkResponse

use of org.xdi.oxauth.client.JwkResponse in project oxAuth by GluuFederation.

the class JwkRestWebServiceHttpTest method requestClientJwks.

@Parameters({ "clientJwksUri" })
@Test
public void requestClientJwks(final String clientJwksUri) throws Exception {
    showTitle("requestJwks");
    JwkClient jwkClient = new JwkClient(clientJwksUri);
    JwkResponse response = jwkClient.exec();
    showClient(jwkClient);
    assertEquals(response.getStatus(), 200, "Unexpected response code: " + response.getEntity());
    assertNotNull(response.getEntity(), "Unexpected result: entity is null");
    assertNotNull(response.getJwks(), "Unexpected result: jwks is null");
    assertNotNull(response.getJwks().getKeys(), "Unexpected result: keys is null");
    assertTrue(response.getJwks().getKeys().size() > 0, "Unexpected result: keys is empty");
    for (JSONWebKey JSONWebKey : response.getJwks().getKeys()) {
        assertNotNull(JSONWebKey.getKid(), "Unexpected result: kid is null");
        assertNotNull(JSONWebKey.getUse(), "Unexpected result: use is null");
    }
}
Also used : JSONWebKey(org.xdi.oxauth.model.jwk.JSONWebKey) JwkResponse(org.xdi.oxauth.client.JwkResponse) JwkClient(org.xdi.oxauth.client.JwkClient) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BaseTest(org.xdi.oxauth.BaseTest)

Example 2 with JwkResponse

use of org.xdi.oxauth.client.JwkResponse in project oxAuth by GluuFederation.

the class JwkRestWebServiceHttpTest method requestJwks.

@Test
public void requestJwks() throws Exception {
    showTitle("requestJwks");
    JwkClient jwkClient = new JwkClient(jwksUri);
    JwkResponse response = jwkClient.exec();
    showClient(jwkClient);
    assertEquals(response.getStatus(), 200, "Unexpected response code: " + response.getEntity());
    assertNotNull(response.getEntity(), "Unexpected result: entity is null");
    assertNotNull(response.getJwks(), "Unexpected result: jwks is null");
    assertNotNull(response.getJwks().getKeys(), "Unexpected result: keys is null");
    assertTrue(response.getJwks().getKeys().size() > 0, "Unexpected result: keys is empty");
    for (JSONWebKey JSONWebKey : response.getJwks().getKeys()) {
        assertNotNull(JSONWebKey.getKid(), "Unexpected result: kid is null");
        assertNotNull(JSONWebKey.getUse(), "Unexpected result: use is null");
    }
}
Also used : JSONWebKey(org.xdi.oxauth.model.jwk.JSONWebKey) JwkResponse(org.xdi.oxauth.client.JwkResponse) JwkClient(org.xdi.oxauth.client.JwkClient) Test(org.testng.annotations.Test) BaseTest(org.xdi.oxauth.BaseTest)

Aggregations

Test (org.testng.annotations.Test)2 BaseTest (org.xdi.oxauth.BaseTest)2 JwkClient (org.xdi.oxauth.client.JwkClient)2 JwkResponse (org.xdi.oxauth.client.JwkResponse)2 JSONWebKey (org.xdi.oxauth.model.jwk.JSONWebKey)2 Parameters (org.testng.annotations.Parameters)1