Search in sources :

Example 1 with GroupPolicy

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

the class GroupPolicyManagementTest method createPolicy.

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

Example 2 with GroupPolicy

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

the class GroupPolicyManagementTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    authorizationPage.navigateTo();
    GroupPolicyRepresentation expected = new GroupPolicyRepresentation();
    expected.setName("Test Group Policy");
    expected.setDescription("description");
    expected.setGroupsClaim("groups");
    expected.addGroupPath("/Group A", true);
    expected.addGroupPath("/Group A/Group B/Group D");
    expected.addGroupPath("Group F");
    expected = createPolicy(expected);
    String previousName = expected.getName();
    expected.setName("Changed Test Group Policy");
    expected.setDescription("Changed description");
    expected.setLogic(Logic.NEGATIVE);
    expected.setGroupsClaim(null);
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(previousName, expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    GroupPolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
    expected.getGroups().clear();
    expected.addGroupPath("/Group A", false);
    expected.addGroupPath("/Group A/Group B/Group D");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(expected.getName(), expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
    expected.getGroups().clear();
    expected.addGroupPath("/Group E");
    expected.addGroupPath("/Group A/Group B", true);
    expected.addGroupPath("/Group A/Group C");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(expected.getName(), expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
}
Also used : GroupPolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.GroupPolicy) GroupPolicyRepresentation(org.keycloak.representations.idm.authorization.GroupPolicyRepresentation) Test(org.junit.Test)

Aggregations

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