Search in sources :

Example 1 with RsCheckAccessParams

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;
}
Also used : RsCheckAccessParams(io.jans.ca.common.params.RsCheckAccessParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse)

Example 2 with RsCheckAccessParams

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
    }
}
Also used : RsCheckAccessParams(io.jans.ca.common.params.RsCheckAccessParams) IOException(java.io.IOException)

Example 3 with RsCheckAccessParams

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()));
}
Also used : RsCheckAccessParams(io.jans.ca.common.params.RsCheckAccessParams) RsCheckAccessResponse(io.jans.ca.common.response.RsCheckAccessResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Aggregations

RsCheckAccessParams (io.jans.ca.common.params.RsCheckAccessParams)3 RsCheckAccessResponse (io.jans.ca.common.response.RsCheckAccessResponse)2 ClientInterface (io.jans.ca.client.ClientInterface)1 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)1 IOException (java.io.IOException)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1