org.keycloak.models.cache.infinispan.authorization

## Class StoreFactoryCacheSession.PolicyCache

- java.lang.Object
- - org.keycloak.models.cache.infinispan.authorization.StoreFactoryCacheSession.PolicyCache

- All Implemented Interfaces:
    PolicyStore
  Enclosing class:
    StoreFactoryCacheSession

      protected class StoreFactoryCacheSession.PolicyCache
      extends Object
      implements PolicyStore

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PolicyCache()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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`
    `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)` Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
    `List<Policy>` | `findByResourceServer(String resourceServerId)` Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
    `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 resourceType, String resourceServerId, Consumer<Policy> consumer)`
    `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`.
    `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 `PolicyStore.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`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PolicyCache

          protected PolicyCache()

  - ### Method Detail

    - #### create

          public Policy create(AbstractPolicyRepresentation representation,
                               ResourceServer resourceServer)

      Description copied from interface: `PolicyStore`
      Creates a new `Policy` instance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.
      Specified by:
        `create` in interface `PolicyStore`
      Parameters:
        `representation` - the policy representation
        `resourceServer` - the resource server to which this policy belongs
      Returns:
        a new instance of `Policy`

    - #### delete

          public void delete(String id)

      Description copied from interface: `PolicyStore`
      Deletes a policy from the underlying persistence mechanism.
      Specified by:
        `delete` in interface `PolicyStore`
      Parameters:
        `id` - the id of the policy to delete

    - #### findById

          public Policy findById(String id,
                                 String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a `Policy` with the given `id`
      Specified by:
        `findById` in interface `PolicyStore`
      Parameters:
        `id` - the identifier of the policy
        `resourceServerId` - the resource server id
      Returns:
        a policy with the given identifier.

    - #### findByName

          public Policy findByName(String name,
                                   String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a `Policy` with the given `name`
      Specified by:
        `findByName` in interface `PolicyStore`
      Parameters:
        `name` - the name of the policy
        `resourceServerId` - the resource server id
      Returns:
        a policy with the given name.

    - #### findByResourceServer

          public List<Policy> findByResourceServer(String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
      Specified by:
        `findByResourceServer` in interface `PolicyStore`
      Parameters:
        `resourceServerId` - the identifier of a resource server
      Returns:
        a list of policies that belong to the given resource server

    - #### findByResourceServer

          public List<Policy> findByResourceServer(Map<Policy.FilterOption,String[]> attributes,
                                                   String resourceServerId,
                                                   int firstResult,
                                                   int maxResult)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
      Specified by:
        `findByResourceServer` in interface `PolicyStore`
      Parameters:
        `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 server
      Returns:
        a list of policies that belong to the given resource server

    - #### findByResource

          public List<Policy> findByResource(String resourceId,
                                             String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `resourceId`.
      Specified by:
        `findByResource` in interface `PolicyStore`
      Parameters:
        `resourceId` - the identifier of a resource
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given resource

    - #### findByResource

          public void findByResource(String resourceId,
                                     String resourceServerId,
                                     Consumer<Policy> consumer)

      Specified by:
        `findByResource` in interface `PolicyStore`

    - #### findByResourceType

          public List<Policy> findByResourceType(String resourceType,
                                                 String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `type`.
      Specified by:
        `findByResourceType` in interface `PolicyStore`
      Parameters:
        `resourceType` - the type of a resource
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given resource type

    - #### findByResourceType

          public void findByResourceType(String resourceType,
                                         String resourceServerId,
                                         Consumer<Policy> consumer)

      Specified by:
        `findByResourceType` in interface `PolicyStore`

    - #### findByScopeIds

          public List<Policy> findByScopeIds(List<String> scopeIds,
                                             String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Scope` with the given `scopeIds`.
      Specified by:
        `findByScopeIds` in interface `PolicyStore`
      Parameters:
        `scopeIds` - the id of the scopes
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given scopes

    - #### findByScopeIds

          public List<Policy> findByScopeIds(List<String> scopeIds,
                                             String resourceId,
                                             String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Scope` with the given `resourceId` and `scopeIds`.
      Specified by:
        `findByScopeIds` in interface `PolicyStore`
      Parameters:
        `scopeIds` - the id of the scopes
        `resourceId` - the id of the resource. Ignored if `null`.
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given scopes

    - #### findByScopeIds

          public void findByScopeIds(List<String> scopeIds,
                                     String resourceId,
                                     String resourceServerId,
                                     Consumer<Policy> consumer)

      Description copied from interface: `PolicyStore`
      Effectively the same method as `PolicyStore.findByScopeIds(List, String, String)`, however in the end the `consumer` is fed with the result.
      Specified by:
        `findByScopeIds` in interface `PolicyStore`

    - #### findByType

          public List<Policy> findByType(String type,
                                         String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` with the given `type`.
      Specified by:
        `findByType` in interface `PolicyStore`
      Parameters:
        `type` - the type of the policy
        `resourceServerId` - the resource server id
      Returns:
        a list of policies with the given type

    - #### findDependentPolicies

          public List<Policy> findDependentPolicies(String id,
                                                    String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` that depends on another policy with the given `id`.
      Specified by:
        `findDependentPolicies` in interface `PolicyStore`
      Parameters:
        `id` - the id of the policy to query its dependents
        `resourceServerId` - the resource server id
      Returns:
        a list of policies that depends on the a policy with the given identifier

Copyright © 2021 JBoss by Red Hat. All rights reserved.