Search in sources :

Example 11 with AggregatePolicyRepresentation

use of org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation in project keycloak by keycloak.

the class AggregatePolicyManagementTest method testDelete.

@Test
public void testDelete() throws InterruptedException {
    authorizationPage.navigateTo();
    AggregatePolicyRepresentation expected = new AggregatePolicyRepresentation();
    expected.setName("Test Delete Aggregate Policy");
    expected.setDescription("description");
    expected.addPolicy("Policy C");
    expected = createPolicy(expected);
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().delete(expected.getName());
    assertAlertSuccess();
    authorizationPage.navigateTo();
    assertNull(authorizationPage.authorizationTabs().policies().policies().findByName(expected.getName()));
}
Also used : AggregatePolicyRepresentation(org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation) Test(org.junit.Test)

Example 12 with AggregatePolicyRepresentation

use of org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation in project keycloak by keycloak.

the class AggregatePolicyManagementTest method testUpdateWithChild.

@Test
public void testUpdateWithChild() {
    AggregatePolicyRepresentation expected = new AggregatePolicyRepresentation();
    expected.setName("Test Child Update Aggregate Policy");
    expected.setDescription("description");
    expected.addPolicy("Policy C");
    AggregatePolicy policy = authorizationPage.authorizationTabs().policies().create(expected);
    assertAlertSuccess();
    assertPolicy(expected, policy);
    RolePolicyRepresentation childPolicy = new RolePolicyRepresentation();
    childPolicy.setName(UUID.randomUUID().toString());
    childPolicy.addRole("Role A");
    policy.createPolicy(childPolicy);
    policy.form().save();
    expected.addPolicy(childPolicy.getName());
    authorizationPage.navigateTo();
    AggregatePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
}
Also used : RolePolicyRepresentation(org.keycloak.representations.idm.authorization.RolePolicyRepresentation) AggregatePolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.AggregatePolicy) AggregatePolicyRepresentation(org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation) Test(org.junit.Test)

Example 13 with AggregatePolicyRepresentation

use of org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation in project keycloak by keycloak.

the class AggregatePolicyManagementTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    authorizationPage.navigateTo();
    AggregatePolicyRepresentation expected = new AggregatePolicyRepresentation();
    expected.setName("Test Update Aggregate Policy");
    expected.setDescription("description");
    expected.addPolicy("Policy A");
    expected.addPolicy("Policy B");
    expected.addPolicy("Policy C");
    expected = createPolicy(expected);
    String previousName = expected.getName();
    expected.setName("Changed Test Update Aggregate Policy");
    expected.setDescription("Changed description");
    expected.setLogic(Logic.NEGATIVE);
    expected.getPolicies().clear();
    expected.addPolicy("Policy A", "Policy C");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(previousName, expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    AggregatePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
}
Also used : AggregatePolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.AggregatePolicy) AggregatePolicyRepresentation(org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation) Test(org.junit.Test)

Example 14 with AggregatePolicyRepresentation

use of org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation in project keycloak by keycloak.

the class AggregatePolicyManagementTest method testDeleteFromList.

@Test
public void testDeleteFromList() throws InterruptedException {
    authorizationPage.navigateTo();
    AggregatePolicyRepresentation expected = new AggregatePolicyRepresentation();
    expected.setName("Test Delete Aggregate Policy");
    expected.setDescription("description");
    expected.addPolicy("Policy C");
    expected = createPolicy(expected);
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().deleteFromList(expected.getName());
    authorizationPage.navigateTo();
    assertNull(authorizationPage.authorizationTabs().policies().policies().findByName(expected.getName()));
}
Also used : AggregatePolicyRepresentation(org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation) Test(org.junit.Test)

Aggregations

AggregatePolicyRepresentation (org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation)14 Test (org.junit.Test)9 RolePolicyRepresentation (org.keycloak.representations.idm.authorization.RolePolicyRepresentation)4 AggregatePolicy (org.keycloak.testsuite.console.page.clients.authorization.policy.AggregatePolicy)4 AggregatePoliciesResource (org.keycloak.admin.client.resource.AggregatePoliciesResource)3 AggregatePolicyResource (org.keycloak.admin.client.resource.AggregatePolicyResource)3 AuthorizationResource (org.keycloak.admin.client.resource.AuthorizationResource)3 Response (javax.ws.rs.core.Response)2 ClientPolicyRepresentation (org.keycloak.representations.idm.authorization.ClientPolicyRepresentation)2 GroupPolicyRepresentation (org.keycloak.representations.idm.authorization.GroupPolicyRepresentation)2 JSPolicyRepresentation (org.keycloak.representations.idm.authorization.JSPolicyRepresentation)2 TimePolicyRepresentation (org.keycloak.representations.idm.authorization.TimePolicyRepresentation)2 UserPolicyRepresentation (org.keycloak.representations.idm.authorization.UserPolicyRepresentation)2 NotFoundException (javax.ws.rs.NotFoundException)1 AbstractPolicyRepresentation (org.keycloak.representations.idm.authorization.AbstractPolicyRepresentation)1 PolicyRepresentation (org.keycloak.representations.idm.authorization.PolicyRepresentation)1 WebElement (org.openqa.selenium.WebElement)1