Search in sources :

Example 1 with ClientPolicy

use of org.keycloak.testsuite.console.page.clients.authorization.policy.ClientPolicy in project keycloak by keycloak.

the class ClientPolicyManagementTest method createPolicy.

private ClientPolicyRepresentation createPolicy(ClientPolicyRepresentation expected) {
    ClientPolicy policy = authorizationPage.authorizationTabs().policies().create(expected);
    assertAlertSuccess();
    return assertPolicy(expected, policy);
}
Also used : ClientPolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.ClientPolicy)

Example 2 with ClientPolicy

use of org.keycloak.testsuite.console.page.clients.authorization.policy.ClientPolicy in project keycloak by keycloak.

the class ClientPolicyManagementTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    authorizationPage.navigateTo();
    ClientPolicyRepresentation expected = new ClientPolicyRepresentation();
    expected.setName("Test Client Policy");
    expected.setDescription("description");
    expected.addClient("client a");
    expected.addClient("client b");
    expected.addClient("client c");
    expected = createPolicy(expected);
    String previousName = expected.getName();
    expected.setName("Changed Test Client Policy");
    expected.setDescription("Changed description");
    expected.setLogic(Logic.NEGATIVE);
    expected.setClients(expected.getClients().stream().filter(client -> !client.equals("client b")).collect(Collectors.toSet()));
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(previousName, expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    ClientPolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
}
Also used : ClientPolicyRepresentation(org.keycloak.representations.idm.authorization.ClientPolicyRepresentation) ClientPolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.ClientPolicy) Test(org.junit.Test)

Aggregations

ClientPolicy (org.keycloak.testsuite.console.page.clients.authorization.policy.ClientPolicy)2 Test (org.junit.Test)1 ClientPolicyRepresentation (org.keycloak.representations.idm.authorization.ClientPolicyRepresentation)1