use of io.jans.ca.common.response.RsCheckAccessResponse in project jans by JanssenProject.
the class RsCheckAccessTest method checkAccess.
public static RsCheckAccessResponse checkAccess(ClientInterface client, RegisterSiteResponse site, List<String> scopeList) {
final RsCheckAccessParams params = new RsCheckAccessParams();
params.setRpId(site.getRpId());
params.setHttpMethod("GET");
params.setPath("/ws/phone");
params.setRpt("dummy");
params.setScopes(scopeList);
final RsCheckAccessResponse response = client.umaRsCheckAccess(Tester.getAuthorization(site), null, params);
assertNotNull(response);
assertTrue(StringUtils.isNotBlank(response.getAccess()));
return response;
}
use of io.jans.ca.common.response.RsCheckAccessResponse in project jans by JanssenProject.
the class UmaGetClaimsGatheringUrlTest method test.
@Parameters({ "host", "opHost", "paramRedirectUrl", "rsProtect" })
@Test
public void test(String host, String opHost, String paramRedirectUrl, String rsProtect) throws IOException {
ClientInterface client = Tester.newClient(host);
RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, paramRedirectUrl);
RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
final RpGetClaimsGatheringUrlParams params = new RpGetClaimsGatheringUrlParams();
params.setRpId(site.getRpId());
params.setTicket(checkAccess.getTicket());
params.setClaimsRedirectUri(paramRedirectUrl);
final RpGetClaimsGatheringUrlResponse response = client.umaRpGetClaimsGatheringUrl(Tester.getAuthorization(site), null, params);
Map<String, String> parameters = CoreUtils.splitQuery(response.getUrl());
assertTrue(StringUtils.isNotBlank(parameters.get("client_id")));
assertTrue(StringUtils.isNotBlank(parameters.get("ticket")));
assertTrue(StringUtils.isNotBlank(parameters.get("state")));
assertTrue(StringUtils.isNotBlank(response.getState()));
assertEquals(paramRedirectUrl, parameters.get("claims_redirect_uri"));
}
use of io.jans.ca.common.response.RsCheckAccessResponse in project jans by JanssenProject.
the class UmaGetClaimsGatheringUrlTest method test_withState.
@Parameters({ "host", "opHost", "paramRedirectUrl", "rsProtect", "state" })
@Test
public void test_withState(String host, String opHost, String paramRedirectUrl, String rsProtect, String state) throws IOException {
ClientInterface client = Tester.newClient(host);
RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, paramRedirectUrl);
RsProtectTest.protectResources(client, site, UmaFullTest.resourceList(rsProtect).getResources());
final RsCheckAccessResponse checkAccess = RsCheckAccessTest.checkAccess(client, site, null);
final RpGetClaimsGatheringUrlParams params = new RpGetClaimsGatheringUrlParams();
params.setRpId(site.getRpId());
params.setTicket(checkAccess.getTicket());
params.setClaimsRedirectUri(paramRedirectUrl);
params.setState(state);
final RpGetClaimsGatheringUrlResponse response = client.umaRpGetClaimsGatheringUrl(Tester.getAuthorization(site), null, params);
Map<String, String> parameters = CoreUtils.splitQuery(response.getUrl());
assertTrue(StringUtils.isNotBlank(parameters.get("client_id")));
assertTrue(StringUtils.isNotBlank(parameters.get("ticket")));
assertTrue(StringUtils.isNotBlank(parameters.get("state")));
assertTrue(StringUtils.isNotBlank(response.getState()));
assertEquals(paramRedirectUrl, parameters.get("claims_redirect_uri"));
assertEquals(response.getState(), state);
}
use of io.jans.ca.common.response.RsCheckAccessResponse in project jans by JanssenProject.
the class RsProtectTest method protectWithScopeExpressionSeconds.
@Parameters({ "host", "redirectUrls", "opHost", "rsProtectScopeExpressionSecond" })
@Test
public void protectWithScopeExpressionSeconds(String host, String redirectUrls, String opHost, String rsProtectScopeExpressionSecond) throws IOException {
ClientInterface client = Tester.newClient(host);
final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
protectResources(client, site, UmaFullTest.resourceList(rsProtectScopeExpressionSecond).getResources());
final RsCheckAccessParams params = new RsCheckAccessParams();
params.setRpId(site.getRpId());
params.setHttpMethod("GET");
params.setPath("/GetAll");
params.setRpt("");
final RsCheckAccessResponse response = client.umaRsCheckAccess(Tester.getAuthorization(site), null, params);
assertNotNull(response);
assertTrue(StringUtils.isNotBlank(response.getAccess()));
}
use of io.jans.ca.common.response.RsCheckAccessResponse 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()));
}
Aggregations