public interface PolicyStore
PolicyStore
is responsible to manage the persistence of Policy
instances.Modifier and Type | Method and Description |
---|---|
Policy |
create(AbstractPolicyRepresentation representation,
ResourceServer resourceServer)
Creates a new
Policy instance. |
void |
delete(String id)
Deletes a policy from the underlying persistence mechanism.
|
Policy |
findById(String id,
String resourceServerId)
Returns a
Policy with the given id |
Policy |
findByName(String name,
String resourceServerId)
Returns a
Policy with the given name |
default List<Policy> |
findByResource(String resourceId,
String resourceServerId)
Returns a list of
Policy associated with a org.keycloak.authorization.core.model.Resource with the given resourceId . |
void |
findByResource(String resourceId,
String resourceServerId,
Consumer<Policy> consumer) |
List<Policy> |
findByResourceServer(Map<Policy.FilterOption,String[]> attributes,
String resourceServerId,
int firstResult,
int maxResult)
|
List<Policy> |
findByResourceServer(String resourceServerId)
|
default List<Policy> |
findByResourceType(String resourceType,
String resourceServerId)
Returns a list of
Policy associated with a org.keycloak.authorization.core.model.Resource with the given type . |
void |
findByResourceType(String type,
String resourceServerId,
Consumer<Policy> policyConsumer) |
List<Policy> |
findByScopeIds(List<String> scopeIds,
String resourceServerId)
Returns a list of
Policy associated with a org.keycloak.authorization.core.model.Scope with the given scopeIds . |
default List<Policy> |
findByScopeIds(List<String> scopeIds,
String resourceId,
String resourceServerId)
Returns a list of
Policy associated with a org.keycloak.authorization.core.model.Scope with the given resourceId and scopeIds . |
void |
findByScopeIds(List<String> scopeIds,
String resourceId,
String resourceServerId,
Consumer<Policy> consumer)
Effectively the same method as
findByScopeIds(List, String, String) , however in the end
the consumer is fed with the result. |
List<Policy> |
findByType(String type,
String resourceServerId)
Returns a list of
Policy with the given type . |
List<Policy> |
findDependentPolicies(String id,
String resourceServerId)
Returns a list of
Policy that depends on another policy with the given id . |
Policy create(AbstractPolicyRepresentation representation, ResourceServer resourceServer)
Policy
instance. The new instance is not necessarily persisted though, which may require
a call to the {#save} method to actually make it persistent.representation
- the policy representationresourceServer
- the resource server to which this policy belongsPolicy
void delete(String id)
id
- the id of the policy to deletePolicy findById(String id, String resourceServerId)
Policy
with the given id
id
- the identifier of the policyresourceServerId
- the resource server idPolicy findByName(String name, String resourceServerId)
Policy
with the given name
name
- the name of the policyresourceServerId
- the resource server idList<Policy> findByResourceServer(String resourceServerId)
resourceServerId
- the identifier of a resource serverList<Policy> findByResourceServer(Map<Policy.FilterOption,String[]> attributes, String resourceServerId, int firstResult, int maxResult)
attributes
- a map holding the attributes that will be used as a filter; possible filter options are given by Policy.FilterOption
resourceServerId
- the identifier of a resource serverIllegalArgumentException
- when there is an unknown attribute in the attributes
mapdefault List<Policy> findByResource(String resourceId, String resourceServerId)
Policy
associated with a org.keycloak.authorization.core.model.Resource
with the given resourceId
.resourceId
- the identifier of a resourceresourceServerId
- the resource server idvoid findByResource(String resourceId, String resourceServerId, Consumer<Policy> consumer)
default List<Policy> findByResourceType(String resourceType, String resourceServerId)
Policy
associated with a org.keycloak.authorization.core.model.Resource
with the given type
.resourceType
- the type of a resourceresourceServerId
- the resource server idList<Policy> findByScopeIds(List<String> scopeIds, String resourceServerId)
Policy
associated with a org.keycloak.authorization.core.model.Scope
with the given scopeIds
.scopeIds
- the id of the scopesresourceServerId
- the resource server iddefault List<Policy> findByScopeIds(List<String> scopeIds, String resourceId, String resourceServerId)
Policy
associated with a org.keycloak.authorization.core.model.Scope
with the given resourceId
and scopeIds
.scopeIds
- the id of the scopesresourceId
- the id of the resource. Ignored if null
.resourceServerId
- the resource server idvoid findByScopeIds(List<String> scopeIds, String resourceId, String resourceServerId, Consumer<Policy> consumer)
findByScopeIds(List, String, String)
, however in the end
the consumer
is fed with the result.List<Policy> findByType(String type, String resourceServerId)
Policy
with the given type
.type
- the type of the policyresourceServerId
- the resource server idList<Policy> findDependentPolicies(String id, String resourceServerId)
Policy
that depends on another policy with the given id
.id
- the id of the policy to query its dependentsresourceServerId
- the resource server idCopyright © 2021 JBoss by Red Hat. All rights reserved.