Search in sources :

Example 1 with RpGetRptParams

use of io.jans.ca.common.params.RpGetRptParams in project jans by JanssenProject.

the class UmaFullTest method test.

@Parameters({ "host", "redirectUrls", "opHost", "rsProtect" })
@Test
public void test(String host, String redirectUrls, String opHost, String rsProtect) throws Exception {
    ClientInterface client = Tester.newClient(host);
    RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
    final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
    final RpGetRptParams params = new RpGetRptParams();
    params.setRpId(site.getRpId());
    params.setTicket(checkAccess.getTicket());
    final RpGetRptResponse response = client.umaRpGetRpt(Tester.getAuthorization(site), null, params);
    assertNotNull(response);
    assertTrue(StringUtils.isNotBlank(response.getRpt()));
    assertTrue(StringUtils.isNotBlank(response.getPct()));
}
Also used : RpGetRptParams(io.jans.ca.common.params.RpGetRptParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) RpGetRptResponse(io.jans.ca.common.response.RpGetRptResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 2 with RpGetRptParams

use of io.jans.ca.common.params.RpGetRptParams in project jans by JanssenProject.

the class UmaFullTest method testWithInvalidTicket.

@Parameters({ "host", "redirectUrls", "opHost", "rsProtect" })
@Test
public void testWithInvalidTicket(String host, String redirectUrls, String opHost, String rsProtect) throws Exception {
    ClientInterface client = Tester.newClient(host);
    RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
    final RpGetRptParams params = new RpGetRptParams();
    params.setRpId(site.getRpId());
    params.setTicket(UUID.randomUUID().toString());
    try {
        client.umaRpGetRpt(Tester.getAuthorization(site), null, params);
    } catch (BadRequestException ex) {
        return;
    }
    throw new AssertionError();
}
Also used : RpGetRptParams(io.jans.ca.common.params.RpGetRptParams) BadRequestException(javax.ws.rs.BadRequestException) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 3 with RpGetRptParams

use of io.jans.ca.common.params.RpGetRptParams in project jans by JanssenProject.

the class RpGetRptTest method requestRpt.

public static RpGetRptResponse requestRpt(ClientInterface client, RegisterSiteResponse site, String rsProtect) throws IOException {
    RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
    final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
    final RpGetRptParams params = new RpGetRptParams();
    params.setRpId(site.getRpId());
    params.setTicket(checkAccess.getTicket());
    final RpGetRptResponse response = client.umaRpGetRpt(Tester.getAuthorization(site), null, params);
    assertNotNull(response);
    assertTrue(StringUtils.isNotBlank(response.getRpt()));
    assertTrue(StringUtils.isNotBlank(response.getPct()));
    return response;
}
Also used : RpGetRptParams(io.jans.ca.common.params.RpGetRptParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse) RpGetRptResponse(io.jans.ca.common.response.RpGetRptResponse)

Example 4 with RpGetRptParams

use of io.jans.ca.common.params.RpGetRptParams in project jans by JanssenProject.

the class UmaFullTest method mockTest.

@Parameters({ "host", "redirectUrls", "opHost", "rsProtect" })
@Test
public void mockTest(String host, String redirectUrls, String opHost, String rsProtect) throws Exception {
    ClientInterface client = Tester.newClient(host);
    RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
    final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
    final RpGetRptParams params = new RpGetRptParams();
    params.setRpId(site.getRpId());
    params.setTicket(checkAccess.getTicket());
    final RpGetRptResponse response = client.umaRpGetRpt(Tester.getAuthorization(), null, params);
    assertNotNull(response);
    assertTrue(StringUtils.isNotBlank(response.getRpt()));
    assertTrue(StringUtils.isNotBlank(response.getPct()));
}
Also used : RpGetRptParams(io.jans.ca.common.params.RpGetRptParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) RpGetRptResponse(io.jans.ca.common.response.RpGetRptResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) RegisterSiteTest(io.jans.ca.server.RegisterSiteTest) RsCheckAccessTest(io.jans.ca.server.RsCheckAccessTest) RsProtectTest(io.jans.ca.server.RsProtectTest)

Example 5 with RpGetRptParams

use of io.jans.ca.common.params.RpGetRptParams in project jans by JanssenProject.

the class DifferentAuthServerTest method umaFullTest_withDifferentAuthServer.

@Parameters({ "host", "authServer", "redirectUrls", "opHost", "rsProtect" })
@Test
public void umaFullTest_withDifferentAuthServer(String host, String authServer, String redirectUrls, String opHost, String rsProtect) throws Exception {
    ClientInterface client = Tester.newClient(host);
    RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    RegisterSiteResponse authServerResp = RegisterSiteTest.registerSite(client, authServer, redirectUrls);
    RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
    final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
    final RpGetRptParams params = new RpGetRptParams();
    params.setRpId(site.getRpId());
    params.setTicket(checkAccess.getTicket());
    final RpGetRptResponse response = client.umaRpGetRpt(Tester.getAuthorization(authServerResp), authServerResp.getRpId(), params);
    Assert.assertNotNull(response);
    assertTrue(StringUtils.isNotBlank(response.getRpt()));
    assertTrue(StringUtils.isNotBlank(response.getPct()));
}
Also used : RpGetRptParams(io.jans.ca.common.params.RpGetRptParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) RpGetRptResponse(io.jans.ca.common.response.RpGetRptResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Aggregations

RpGetRptParams (io.jans.ca.common.params.RpGetRptParams)5 ClientInterface (io.jans.ca.client.ClientInterface)4 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)4 RpGetRptResponse (io.jans.ca.common.response.RpGetRptResponse)4 RsCheckAccessResponse (io.jans.ca.common.response.RsCheckAccessResponse)4 Parameters (org.testng.annotations.Parameters)4 Test (org.testng.annotations.Test)4 RegisterSiteTest (io.jans.ca.server.RegisterSiteTest)1 RsCheckAccessTest (io.jans.ca.server.RsCheckAccessTest)1 RsProtectTest (io.jans.ca.server.RsProtectTest)1 BadRequestException (javax.ws.rs.BadRequestException)1