use of org.keycloak.testsuite.console.page.clients.authorization.permission.ScopePermission in project keycloak by keycloak.
the class ScopePermissionManagementTest method testUpdateScopeOnly.
@Test
public void testUpdateScopeOnly() {
authorizationPage.navigateTo();
ScopePermissionRepresentation expected = new ScopePermissionRepresentation();
expected.setName("testUpdateScopeOnly Permission");
expected.setDescription("description");
expected.addScope("Scope C", "Scope A", "Scope B");
expected.addPolicy("Policy C", "Policy A", "Policy B");
expected = createPermission(expected);
String previousName = expected.getName();
expected.setName(previousName + "Changed");
expected.setDescription("changed");
expected.setDecisionStrategy(DecisionStrategy.CONSENSUS);
expected.getScopes().clear();
expected.addScope("Scope B");
expected.getPolicies().clear();
expected.addPolicy("Policy C");
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().permissions().update(previousName, expected);
assertAlertSuccess();
authorizationPage.navigateTo();
ScopePermission actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
}
use of org.keycloak.testsuite.console.page.clients.authorization.permission.ScopePermission in project keycloak by keycloak.
the class ScopePermissionManagementTest method testCreateUpdateWithChild.
@Test
public void testCreateUpdateWithChild() {
ScopePermissionRepresentation expected = new ScopePermissionRepresentation();
expected.setName(UUID.randomUUID().toString());
expected.setDescription("description");
expected.addScope("Scope C");
expected.addPolicy("Policy C");
ScopePermission policy = authorizationPage.authorizationTabs().permissions().create(expected, false);
RolePolicyRepresentation childPolicy = new RolePolicyRepresentation();
childPolicy.setName(UUID.randomUUID().toString());
childPolicy.addRole("Role A");
policy.createPolicy(childPolicy);
policy.form().save();
assertAlertSuccess();
expected.addPolicy(childPolicy.getName());
authorizationPage.navigateTo();
ScopePermission actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
RolePolicyRepresentation childPolicy2 = new RolePolicyRepresentation();
childPolicy2.setName(UUID.randomUUID().toString());
childPolicy2.addRole("Role A");
policy.createPolicy(childPolicy2);
policy.form().save();
assertAlertSuccess();
expected.addPolicy(childPolicy2.getName());
authorizationPage.navigateTo();
actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
expected.addResource("Resource B");
expected.getScopes().clear();
expected.addScope("Scope B", "Scope C");
expected.getScopes().remove("Policy C");
RolePolicyRepresentation childPolicy3 = new RolePolicyRepresentation();
childPolicy3.setName(UUID.randomUUID().toString());
childPolicy3.addRole("Role A");
policy.update(expected, false);
policy.createPolicy(childPolicy3);
policy.form().save();
assertAlertSuccess();
expected.addPolicy(childPolicy3.getName());
authorizationPage.navigateTo();
actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
}
use of org.keycloak.testsuite.console.page.clients.authorization.permission.ScopePermission in project keycloak by keycloak.
the class ScopePermissionManagementTest method testUpdateResourceScope.
@Test
public void testUpdateResourceScope() {
authorizationPage.navigateTo();
ScopePermissionRepresentation expected = new ScopePermissionRepresentation();
expected.setName("testUpdateResourceScope Permission");
expected.setDescription("description");
expected.addResource("Resource A");
expected.addScope("Scope A");
expected.addPolicy("Policy C", "Policy A", "Policy B");
expected = createPermission(expected);
String previousName = expected.getName();
expected.setName(previousName + "Changed");
expected.setDescription("changed");
expected.setDecisionStrategy(DecisionStrategy.CONSENSUS);
expected.getResources().clear();
expected.addResource("Resource B");
expected.getScopes().clear();
expected.addScope("Scope B", "Scope C");
expected.getPolicies().clear();
expected.addPolicy("Policy C");
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().permissions().update(previousName, expected);
assertAlertSuccess();
authorizationPage.navigateTo();
ScopePermission actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
expected.getPolicies().clear();
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().permissions().update(expected.getName(), expected);
assertAlertSuccess();
authorizationPage.navigateTo();
actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
}
use of org.keycloak.testsuite.console.page.clients.authorization.permission.ScopePermission in project keycloak by keycloak.
the class ScopePermissionManagementTest method createPermission.
private ScopePermissionRepresentation createPermission(ScopePermissionRepresentation expected) {
ScopePermission policy = authorizationPage.authorizationTabs().permissions().create(expected, true);
assertAlertSuccess();
return assertPolicy(expected, policy);
}
use of org.keycloak.testsuite.console.page.clients.authorization.permission.ScopePermission in project keycloak by keycloak.
the class ScopePermissionManagementTest method testCreateWithoutPolicies.
@Test
public void testCreateWithoutPolicies() {
authorizationPage.navigateTo();
ScopePermissionRepresentation expected = new ScopePermissionRepresentation();
expected.setName("testCreateWithoutPolicies Permission");
expected.setDescription("description");
expected.addResource("Resource A");
expected.addScope("Scope A");
expected = createPermission(expected);
authorizationPage.navigateTo();
ScopePermission actual = authorizationPage.authorizationTabs().permissions().name(expected.getName());
assertPolicy(expected, actual);
}
Aggregations