use of io.jans.ca.client.ClientInterface 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.client.ClientInterface in project jans by JanssenProject.
the class RsProtectTest method protect_withResourceCreationExpiration.
@Parameters({ "host", "redirectUrls", "opHost", "rsProtectWithCreationExpiration" })
@Test
public void protect_withResourceCreationExpiration(String host, String redirectUrls, String opHost, String rsProtectWithCreationExpiration) throws IOException {
ClientInterface client = Tester.newClient(host);
final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
protectResources(client, site, UmaFullTest.resourceList(rsProtectWithCreationExpiration).getResources());
Rp rp = persistenceService.getRp(site.getRpId());
rp.getUmaProtectedResources().forEach(ele -> {
assertEquals(1582890956L, ele.getIat().longValue());
assertEquals(2079299799L, ele.getExp().longValue());
});
}
use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.
the class RsProtectTest method overwriteTrue.
@Parameters({ "host", "redirectUrls", "opHost", "rsProtect" })
@Test
public void overwriteTrue(String host, String redirectUrls, String opHost, String rsProtect) throws IOException {
ClientInterface client = Tester.newClient(host);
final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
List<RsResource> resources = UmaFullTest.resourceList(rsProtect).getResources();
protectResources(client, site, resources);
final RsProtectParams2 params = new RsProtectParams2();
params.setRpId(site.getRpId());
params.setResources(Jackson2.createJsonMapper().readTree(Jackson2.asJsonSilently(resources)));
// force overwrite
params.setOverwrite(true);
RsProtectResponse response = client.umaRsProtect(Tester.getAuthorization(site), null, params);
assertNotNull(response);
}
use of io.jans.ca.client.ClientInterface 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()));
}
use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.
the class GetJwksTest method test.
@Test(enabled = false)
@Parameters({ "host", "opHost", "opDiscoveryPath" })
public void test(String host, String opHost, @Optional String opDiscoveryPath) {
final ClientInterface client = Tester.newClient(host);
final GetJwksParams params = new GetJwksParams();
params.setOpHost(opHost);
params.setOpDiscoveryPath(opDiscoveryPath);
final GetJwksResponse response = client.getJwks(Tester.getAuthorization(), null, params);
assertNotNull(response);
assertNotNull(response.getKeys());
assertFalse(response.getKeys().isEmpty());
}
Aggregations