Class ResourcePermission
java.lang.Object
org.keycloak.authorization.permission.ResourcePermission
Represents a permission for a given resource.
- Author:
- Pedro Igor
-
Constructor Summary
ConstructorDescriptionResourcePermission
(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer) ResourcePermission
(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer, Map<String, ? extends Collection<String>> claims) ResourcePermission
(Resource resource, ResourceServer resourceServer, Map<String, ? extends Collection<String>> claims) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a permission claim with the given name and a single value.void
void
Returns all permission claims.Returns the resource to which this permission applies.Returns the resource server associated with this permission.Returns a list of permitted scopes associated with the resourceboolean
void
removeClaim
(String name) Removes a permission claim.void
setGranted
(boolean granted)
-
Constructor Details
-
ResourcePermission
public ResourcePermission(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer) -
ResourcePermission
public ResourcePermission(Resource resource, ResourceServer resourceServer, Map<String, ? extends Collection<String>> claims) -
ResourcePermission
public ResourcePermission(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer, Map<String, ? extends Collection<String>> claims)
-
-
Method Details
-
getResource
Returns the resource to which this permission applies.- Returns:
- the resource to which this permission applies
-
getScopes
Returns a list of permitted scopes associated with the resource- Returns:
- a lit of permitted scopes
-
getResourceServer
Returns the resource server associated with this permission.- Returns:
- the resource server
-
getClaims
Returns all permission claims.- Returns:
-
addClaim
Adds a permission claim with the given name and a single value.
If a claim already exists, the value is added to list of values of the existing claim
- Parameters:
name
- the name of the claimvalue
- the value of the claim
-
removeClaim
Removes a permission claim.
- Parameters:
name
- the name of the claim
-
addScope
-
addClaims
-
setGranted
public void setGranted(boolean granted) -
isGranted
public boolean isGranted()
-