Search in sources :

Example 6 with ResponseAsserter

use of org.gluu.oxauth.client.ResponseAsserter in project oxAuth by GluuFederation.

the class OpenIDRequestObjectWithRSAlgEmbeddedTest method requestParameterMethodRS384X509CertStep1.

@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodRS384X509CertStep1(final String registerPath, final String redirectUris, final String jwksUri) throws Exception {
    Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
    String registerRequestContent = null;
    try {
        List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
        RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
        registerRequest.setJwksUri(jwksUri);
        registerRequest.setResponseTypes(responseTypes);
        registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS384);
        registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
        registerRequestContent = ServerUtil.toPrettyJson(registerRequest.getJSONParameters());
    } catch (JSONException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    Response response = request.post(Entity.json(registerRequestContent));
    String entity = response.readEntity(String.class);
    showResponse("requestParameterMethodRS384X509CertStep1", response, entity);
    ResponseAsserter responseAsserter = ResponseAsserter.of(response.getStatus(), entity);
    responseAsserter.assertRegisterResponse();
    clientId5 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
Also used : Response(javax.ws.rs.core.Response) RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ResponseAsserter(org.gluu.oxauth.client.ResponseAsserter) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Builder(javax.ws.rs.client.Invocation.Builder) JSONException(org.json.JSONException) ResponseType(org.gluu.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 7 with ResponseAsserter

use of org.gluu.oxauth.client.ResponseAsserter in project oxAuth by GluuFederation.

the class OpenIDRequestObjectWithESAlgEmbeddedTest method requestParameterMethodES384Step1.

@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodES384Step1(final String registerPath, final String redirectUris, final String jwksUri) throws Exception {
    Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
    String registerRequestContent = null;
    try {
        List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
        RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
        registerRequest.setJwksUri(jwksUri);
        registerRequest.setResponseTypes(responseTypes);
        registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.ES384);
        registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
        registerRequestContent = ServerUtil.toPrettyJson(registerRequest.getJSONParameters());
    } catch (JSONException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    Response response = request.post(Entity.json(registerRequestContent));
    String entity = response.readEntity(String.class);
    showResponse("requestParameterMethodES384Step1", response, entity);
    ResponseAsserter responseAsserter = ResponseAsserter.of(response.getStatus(), entity);
    responseAsserter.assertRegisterResponse();
    clientId2 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
Also used : Response(javax.ws.rs.core.Response) RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ResponseAsserter(org.gluu.oxauth.client.ResponseAsserter) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Builder(javax.ws.rs.client.Invocation.Builder) JSONException(org.json.JSONException) ResponseType(org.gluu.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 8 with ResponseAsserter

use of org.gluu.oxauth.client.ResponseAsserter in project oxAuth by GluuFederation.

the class OpenIDRequestObjectWithESAlgEmbeddedTest method requestParameterMethodES256Step1.

@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodES256Step1(final String registerPath, final String redirectUris, final String jwksUri) throws Exception {
    Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
    String registerRequestContent = null;
    try {
        List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
        RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
        registerRequest.setJwksUri(jwksUri);
        registerRequest.setResponseTypes(responseTypes);
        registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.ES256);
        registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
        registerRequestContent = ServerUtil.toPrettyJson(registerRequest.getJSONParameters());
    } catch (JSONException e) {
        fail(e.getMessage(), e);
    }
    Response response = request.post(Entity.json(registerRequestContent));
    String entity = response.readEntity(String.class);
    showResponse("requestParameterMethodES256Step1", response, entity);
    ResponseAsserter responseAsserter = ResponseAsserter.of(response.getStatus(), entity);
    responseAsserter.assertRegisterResponse();
    clientId1 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
Also used : Response(javax.ws.rs.core.Response) RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ResponseAsserter(org.gluu.oxauth.client.ResponseAsserter) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Builder(javax.ws.rs.client.Invocation.Builder) JSONException(org.json.JSONException) ResponseType(org.gluu.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 9 with ResponseAsserter

use of org.gluu.oxauth.client.ResponseAsserter in project oxAuth by GluuFederation.

the class OpenIDRequestObjectWithESAlgEmbeddedTest method requestParameterMethodES384X509CertStep1.

@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodES384X509CertStep1(final String registerPath, final String redirectUris, final String jwksUri) throws Exception {
    Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
    String registerRequestContent = null;
    try {
        List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
        RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
        registerRequest.setJwksUri(jwksUri);
        registerRequest.setResponseTypes(responseTypes);
        registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.ES384);
        registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
        registerRequestContent = ServerUtil.toPrettyJson(registerRequest.getJSONParameters());
    } catch (JSONException e) {
        fail(e.getMessage(), e);
    }
    Response response = request.post(Entity.json(registerRequestContent));
    String entity = response.readEntity(String.class);
    showResponse("requestParameterMethodES384X509CertStep1", response, entity);
    ResponseAsserter responseAsserter = ResponseAsserter.of(response.getStatus(), entity);
    responseAsserter.assertRegisterResponse();
    clientId5 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
Also used : Response(javax.ws.rs.core.Response) RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ResponseAsserter(org.gluu.oxauth.client.ResponseAsserter) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Builder(javax.ws.rs.client.Invocation.Builder) JSONException(org.json.JSONException) ResponseType(org.gluu.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 10 with ResponseAsserter

use of org.gluu.oxauth.client.ResponseAsserter in project oxAuth by GluuFederation.

the class OpenIDRequestObjectWithRSAlgEmbeddedTest method requestParameterMethodRS256Step1.

@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodRS256Step1(final String registerPath, final String redirectUris, final String jwksUri) throws Exception {
    Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
    String registerRequestContent = null;
    try {
        List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
        RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
        registerRequest.setJwksUri(jwksUri);
        registerRequest.setResponseTypes(responseTypes);
        registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256);
        registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
        registerRequestContent = ServerUtil.toPrettyJson(registerRequest.getJSONParameters());
    } catch (JSONException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    Response response = request.post(Entity.json(registerRequestContent));
    String entity = response.readEntity(String.class);
    showResponse("requestParameterMethodRS256Step1", response, entity);
    ResponseAsserter responseAsserter = ResponseAsserter.of(response.getStatus(), entity);
    responseAsserter.assertRegisterResponse();
    clientId1 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
Also used : Response(javax.ws.rs.core.Response) RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ResponseAsserter(org.gluu.oxauth.client.ResponseAsserter) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Builder(javax.ws.rs.client.Invocation.Builder) JSONException(org.json.JSONException) ResponseType(org.gluu.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Aggregations

Builder (javax.ws.rs.client.Invocation.Builder)12 Response (javax.ws.rs.core.Response)12 BaseTest (org.gluu.oxauth.BaseTest)12 RegisterRequest (org.gluu.oxauth.client.RegisterRequest)12 ResponseAsserter (org.gluu.oxauth.client.ResponseAsserter)12 ResponseType (org.gluu.oxauth.model.common.ResponseType)12 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)12 JSONException (org.json.JSONException)12 Parameters (org.testng.annotations.Parameters)12 Test (org.testng.annotations.Test)12