Class StoreFactoryCacheSession.PolicyCache
java.lang.Object
org.keycloak.models.cache.infinispan.authorization.StoreFactoryCacheSession.PolicyCache
- All Implemented Interfaces:
PolicyStore
- Enclosing class:
- StoreFactoryCacheSession
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(ResourceServer resourceServer, AbstractPolicyRepresentation representation) Creates a newPolicyinstance.voidDeletes a policy from the underlying persistence mechanism.find(ResourceServer resourceServer, Map<Policy.FilterOption, String[]> attributes, Integer firstResult, Integer maxResults) findById(ResourceServer resourceServer, String id) Returns aPolicywith the givenidfindByName(ResourceServer resourceServer, String name) Returns aPolicywith the givennamefindByResource(ResourceServer resourceServer, Resource resource) voidfindByResource(ResourceServer resourceServer, Resource resource, Consumer<Policy> consumer) Searches for all policies associated with theResourceand passes the result to theconsumerfindByResourceServer(ResourceServer resourceServer) Returns a list ofPolicyassociated with theResourceServerfindByResourceType(ResourceServer resourceServer, String resourceType) voidfindByResourceType(ResourceServer resourceServer, String resourceType, Consumer<Policy> consumer) Searches for policies associated with aResourceServerand passes the result to the consumerfindByScopes(ResourceServer resourceServer, List<Scope> scopes) findByScopes(ResourceServer resourceServer, Resource resource, List<Scope> scopes) voidfindByScopes(ResourceServer resourceServer, Resource resource, List<Scope> scopes, Consumer<Policy> consumer) Effectively the same method asPolicyStore.findByScopes(ResourceServer, Resource, List), however in the end theconsumeris fed with the result.findByType(ResourceServer resourceServer, String type) Returns a list ofPolicywith the giventype.findDependentPolicies(ResourceServer resourceServer, String id) Returns a list ofPolicythat depends on another policy with the givenid.findDependentPolicies(ResourceServer resourceServer, String resourceType, String associatedPolicyType, String configKey, String configValue) findDependentPolicies(ResourceServer resourceServer, String resourceType, String associatedPolicyType, String configKey, List<String> configValue)
-
Constructor Details
-
PolicyCache
protected PolicyCache()
-
-
Method Details
-
create
Description copied from interface:PolicyStoreCreates a newPolicyinstance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.- Specified by:
createin interfacePolicyStore- Parameters:
resourceServer- the resource server to which this policy belongs. Cannot benull.representation- the policy representation- Returns:
- a new instance of
Policy
-
delete
Description copied from interface:PolicyStoreDeletes a policy from the underlying persistence mechanism.- Specified by:
deletein interfacePolicyStore- Parameters:
id- the id of the policy to delete
-
findById
Description copied from interface:PolicyStoreReturns aPolicywith the givenid- Specified by:
findByIdin interfacePolicyStore- Parameters:
resourceServer- the resource server. Ignored ifnull.id- the identifier of the policy- Returns:
- a policy with the given identifier.
-
findByName
Description copied from interface:PolicyStoreReturns aPolicywith the givenname- Specified by:
findByNamein interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benullname- the name of the policy- Returns:
- a policy with the given name or
nullif no such policy exists.
-
findByResourceServer
Description copied from interface:PolicyStoreReturns a list ofPolicyassociated with theResourceServer- Specified by:
findByResourceServerin interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benull.- Returns:
- a list of policies that belong to the given resource server
-
find
public List<Policy> find(ResourceServer resourceServer, Map<Policy.FilterOption, String[]> attributes, Integer firstResult, Integer maxResults) Description copied from interface:PolicyStore- Specified by:
findin interfacePolicyStore- Parameters:
resourceServer- the identifier of a resource server. Ignored ifnull.attributes- a map holding the attributes that will be used as a filter; possible filter options are given byPolicy.FilterOptionfirstResult- first result to return. Ignored if negative ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a list of policies that belong to the given resource server
-
findByResource
Description copied from interface:PolicyStore- Specified by:
findByResourcein interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benull.resource- the resource. Cannot benull.- Returns:
- a list of policies associated with the given resource
-
findByResource
public void findByResource(ResourceServer resourceServer, Resource resource, Consumer<Policy> consumer) Description copied from interface:PolicyStoreSearches for all policies associated with theResourceand passes the result to theconsumer- Specified by:
findByResourcein interfacePolicyStore- Parameters:
resourceServer- the resourceServer. Cannot benull.resource- the resource. Cannot benull.consumer- consumer of policies resulted from the search
-
findByResourceType
Description copied from interface:PolicyStore- Specified by:
findByResourceTypein interfacePolicyStore- Parameters:
resourceServer- the resource server id. Cannot benull.resourceType- the type of a resource- Returns:
- a list of policies associated with the given resource type
-
findByResourceType
public void findByResourceType(ResourceServer resourceServer, String resourceType, Consumer<Policy> consumer) Description copied from interface:PolicyStoreSearches for policies associated with aResourceServerand passes the result to the consumer- Specified by:
findByResourceTypein interfacePolicyStore- Parameters:
resourceServer- the resourceServer. Cannot benull.resourceType- the type of a resourceconsumer- consumer of policies resulted from the search
-
findByScopes
Description copied from interface:PolicyStore- Specified by:
findByScopesin interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benull.scopes- the scopes- Returns:
- a list of policies associated with the given scopes
-
findByScopes
public List<Policy> findByScopes(ResourceServer resourceServer, Resource resource, List<Scope> scopes) Description copied from interface:PolicyStore- Specified by:
findByScopesin interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benull.resource- the resource. Ignored ifnull.scopes- the scopes- Returns:
- a list of policies associated with the given scopes
-
findByScopes
public void findByScopes(ResourceServer resourceServer, Resource resource, List<Scope> scopes, Consumer<Policy> consumer) Description copied from interface:PolicyStoreEffectively the same method asPolicyStore.findByScopes(ResourceServer, Resource, List), however in the end theconsumeris fed with the result.- Specified by:
findByScopesin interfacePolicyStore
-
findByType
Description copied from interface:PolicyStoreReturns a list ofPolicywith the giventype.- Specified by:
findByTypein interfacePolicyStore- Parameters:
resourceServer- the resource server id. Cannot benull.type- the type of the policy- Returns:
- a list of policies with the given type
-
findDependentPolicies
Description copied from interface:PolicyStoreReturns a list ofPolicythat depends on another policy with the givenid.- Specified by:
findDependentPoliciesin interfacePolicyStore- Parameters:
resourceServer- the resource server. Cannot benull.id- the id of the policy to query its dependents- Returns:
- a list of policies that depends on the a policy with the given identifier
-
findDependentPolicies
public Stream<Policy> findDependentPolicies(ResourceServer resourceServer, String resourceType, String associatedPolicyType, String configKey, String configValue) - Specified by:
findDependentPoliciesin interfacePolicyStore
-
findDependentPolicies
public Stream<Policy> findDependentPolicies(ResourceServer resourceServer, String resourceType, String associatedPolicyType, String configKey, List<String> configValue) - Specified by:
findDependentPoliciesin interfacePolicyStore
-