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()));
}
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);
}
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);
}
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()));
}
Aggregations