Search in sources :

Example 76 with PolicyRepresentation

use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project quarkus by quarkusio.

the class KeycloakTestResource method createPermission.

private static void createPermission(ResourceServerRepresentation settings, ResourceRepresentation resource, PolicyRepresentation policy) {
    PolicyRepresentation permission = new PolicyRepresentation();
    permission.setName(resource.getName() + " Permission");
    permission.setType("resource");
    permission.setResources(new HashSet<>());
    permission.getResources().add(resource.getName());
    permission.setPolicies(new HashSet<>());
    permission.getPolicies().add(policy.getName());
    settings.getPolicies().add(permission);
}
Also used : PolicyRepresentation(org.keycloak.representations.idm.authorization.PolicyRepresentation)

Aggregations

PolicyRepresentation (org.keycloak.representations.idm.authorization.PolicyRepresentation)76 Test (org.junit.Test)28 ResourceRepresentation (org.keycloak.representations.idm.authorization.ResourceRepresentation)20 HashMap (java.util.HashMap)19 AuthorizationResource (org.keycloak.admin.client.resource.AuthorizationResource)19 Response (javax.ws.rs.core.Response)14 ArrayList (java.util.ArrayList)11 List (java.util.List)11 Map (java.util.Map)11 IOException (java.io.IOException)10 RoleRepresentation (org.keycloak.representations.idm.RoleRepresentation)10 AbstractPolicyRepresentation (org.keycloak.representations.idm.authorization.AbstractPolicyRepresentation)10 UserPolicyRepresentation (org.keycloak.representations.idm.authorization.UserPolicyRepresentation)10 WebElement (org.openqa.selenium.WebElement)10 Collectors (java.util.stream.Collectors)9 Policy (org.keycloak.authorization.model.Policy)9 ClientRepresentation (org.keycloak.representations.idm.ClientRepresentation)9 ScopeRepresentation (org.keycloak.representations.idm.authorization.ScopeRepresentation)9 HashSet (java.util.HashSet)8 Set (java.util.Set)8