Search in sources :

Example 1 with Policies

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

the class DefaultAuthorizationSettingsTest method assertDefaultSettings.

private void assertDefaultSettings() {
    AuthorizationSettingsForm settings = authorizationPage.settings();
    assertEquals(PolicyEnforcerConfig.EnforcementMode.ENFORCING, settings.getEnforcementMode());
    assertEquals(true, settings.isAllowRemoteResourceManagement());
    assertEquals(DecisionStrategy.UNANIMOUS, settings.getDecisionStrategy());
    assertEquals(true, settings.isAllowRemoteResourceManagement());
    Resources resources = authorizationPage.authorizationTabs().resources();
    ResourceRepresentation resource = resources.resources().findByName("Default Resource");
    assertNotNull(resource);
    assertEquals("urn:oidc-confidetial:resources:default", resource.getType());
    assertEquals("/*", resource.getUri());
    assertEquals(newClient.getClientId(), resource.getOwner().getName());
    Scopes scopes = authorizationPage.authorizationTabs().scopes();
    assertTrue(scopes.scopes().getTableRows().isEmpty());
    Permissions permissions = authorizationPage.authorizationTabs().permissions();
    PolicyRepresentation permission = permissions.permissions().findByName("Default Permission");
    assertNotNull(permission);
    assertEquals("resource", permission.getType());
    Policies policies = authorizationPage.authorizationTabs().policies();
    PolicyRepresentation policy = policies.policies().findByName("Default Policy");
    assertNotNull(policy);
    assertEquals("js", policy.getType());
}
Also used : PolicyRepresentation(org.keycloak.representations.idm.authorization.PolicyRepresentation) Policies(org.keycloak.testsuite.console.page.clients.authorization.policy.Policies) Scopes(org.keycloak.testsuite.console.page.clients.authorization.scope.Scopes) Permissions(org.keycloak.testsuite.console.page.clients.authorization.permission.Permissions) Resources(org.keycloak.testsuite.console.page.clients.authorization.resource.Resources) AuthorizationSettingsForm(org.keycloak.testsuite.console.page.clients.authorization.AuthorizationSettingsForm) ResourceRepresentation(org.keycloak.representations.idm.authorization.ResourceRepresentation)

Aggregations

PolicyRepresentation (org.keycloak.representations.idm.authorization.PolicyRepresentation)1 ResourceRepresentation (org.keycloak.representations.idm.authorization.ResourceRepresentation)1 AuthorizationSettingsForm (org.keycloak.testsuite.console.page.clients.authorization.AuthorizationSettingsForm)1 Permissions (org.keycloak.testsuite.console.page.clients.authorization.permission.Permissions)1 Policies (org.keycloak.testsuite.console.page.clients.authorization.policy.Policies)1 Resources (org.keycloak.testsuite.console.page.clients.authorization.resource.Resources)1 Scopes (org.keycloak.testsuite.console.page.clients.authorization.scope.Scopes)1