use of io.jans.ca.common.params.RsCheckAccessParams 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.params.RsCheckAccessParams in project jans by JanssenProject.
the class RsCheckAccessTest method checkAccessWithIncorrectScopes.
public static void checkAccessWithIncorrectScopes(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);
try {
client.umaRsCheckAccess(Tester.getAuthorization(site), null, params);
assertTrue(false);
} catch (Exception e) {
// test-case passed
}
}
use of io.jans.ca.common.params.RsCheckAccessParams 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()));
}
Aggregations