Class StoreFactoryCacheSession.ResourceCache

java.lang.Object
org.keycloak.models.cache.infinispan.authorization.StoreFactoryCacheSession.ResourceCache
All Implemented Interfaces:
ResourceStore
Enclosing class:
StoreFactoryCacheSession

protected class StoreFactoryCacheSession.ResourceCache extends Object implements ResourceStore
  • Constructor Details

    • ResourceCache

      protected ResourceCache()
  • Method Details

    • create

      public Resource create(ResourceServer resourceServer, String id, String name, String owner)
      Description copied from interface: ResourceStore

      Creates a Resource instance backed by this persistent storage implementation.

      Specified by:
      create in interface ResourceStore
      Parameters:
      resourceServer - the resource server to where the given resource belongs to. Cannot be null.
      id - the id of this resource. It must be unique. Will be randomly generated if null.
      name - the name of this resource. It must be unique.
      owner - the owner of this resource or null if the resource server is the owner
      Returns:
      an instance backed by the underlying storage implementation
    • delete

      public void delete(String id)
      Description copied from interface: ResourceStore
      Removes a Resource instance, with the given id from the persistent storage.
      Specified by:
      delete in interface ResourceStore
      Parameters:
      id - the identifier of an existing resource instance
    • findById

      public Resource findById(ResourceServer resourceServer, String id)
      Description copied from interface: ResourceStore
      Returns a Resource instance based on its identifier.
      Specified by:
      findById in interface ResourceStore
      Parameters:
      resourceServer - the resource server. Ignored if null
      id - the identifier of an existing resource instance
      Returns:
      the resource instance with the given identifier or null if no instance was found
    • findByName

      public Resource findByName(ResourceServer resourceServer, String name, String ownerId)
      Description copied from interface: ResourceStore
      Find a Resource by its name where the owner is the given ownerId.
      Specified by:
      findByName in interface ResourceStore
      Parameters:
      resourceServer - the identifier of the resource server. Searches for resources without a resourceServer if null.
      name - the name of the resource
      ownerId - the owner id
      Returns:
      a resource with the given name
    • findByOwner

      public List<Resource> findByOwner(ResourceServer resourceServer, String ownerId)
      Description copied from interface: ResourceStore
      Finds all Resource instances with the given ownerId.
      Specified by:
      findByOwner in interface ResourceStore
      Parameters:
      resourceServer - resource server. Ignored if null
      ownerId - the identifier of the owner
      Returns:
      a list with all resource instances owned by the given owner
    • findByOwner

      public void findByOwner(ResourceServer resourceServer, String ownerId, Consumer<Resource> consumer)
      Description copied from interface: ResourceStore
      Effectively the same method as ResourceStore.findByOwner(ResourceServer, String), however in the end the consumer is fed with the result.
      Specified by:
      findByOwner in interface ResourceStore
    • findByResourceServer

      public List<Resource> findByResourceServer(ResourceServer resourceServer)
      Description copied from interface: ResourceStore
      Finds all Resource instances associated with a given resource server.
      Specified by:
      findByResourceServer in interface ResourceStore
      Parameters:
      resourceServer - the identifier of the resource server. Searches for resources without a resourceServer if null.
      Returns:
      a list with all resources associated with the given resource server
    • find

      public List<Resource> find(ResourceServer resourceServer, Map<Resource.FilterOption,String[]> attributes, Integer firstResult, Integer maxResults)
      Description copied from interface: ResourceStore
      Finds all Resource instances associated with a given resource server.
      Specified by:
      find in interface ResourceStore
      Parameters:
      resourceServer - the identifier of the resource server. Ignored if null.
      attributes - a map holding the attributes that will be used as a filter; possible filter options are given by Resource.FilterOption
      firstResult - first result to return. Ignored if negative or null.
      maxResults - maximum number of results to return. Ignored if negative or null.
      Returns:
      a list with all resources associated with the given resource server
    • findByScopes

      public List<Resource> findByScopes(ResourceServer resourceServer, Set<Scope> scopes)
      Description copied from interface: ResourceStore
      Finds all Resource associated with a given scope.
      Specified by:
      findByScopes in interface ResourceStore
      Parameters:
      resourceServer - the resource server. Searches for resources without a resourceServer if null.
      scopes - one or more scope identifiers
      Returns:
      a list of resources associated with the given scope(s)
    • findByScopes

      public void findByScopes(ResourceServer resourceServer, Set<Scope> scopes, Consumer<Resource> consumer)
      Specified by:
      findByScopes in interface ResourceStore
    • findByType

      public List<Resource> findByType(ResourceServer resourceServer, String type)
      Description copied from interface: ResourceStore
      Finds all Resource associated with the ResourceServer with the given type.
      Specified by:
      findByType in interface ResourceStore
      Parameters:
      resourceServer - the resource server. Searches for resources without a resourceServer if null.
      type - the type of the resource
      Returns:
      a list of resources with the given type
    • findByType

      public void findByType(ResourceServer resourceServer, String type, Consumer<Resource> consumer)
      Description copied from interface: ResourceStore
      Finds all Resource from ResourceServer with the given type.
      Specified by:
      findByType in interface ResourceStore
      Parameters:
      resourceServer - the resource server id. Searches for resources without a resourceServer if null.
      type - the type of the resource
      consumer - the result consumer
    • findByType

      public void findByType(ResourceServer resourceServer, String type, String owner, Consumer<Resource> consumer)
      Description copied from interface: ResourceStore
      Finds all Resource with the given type.
      Specified by:
      findByType in interface ResourceStore
      Parameters:
      resourceServer - the resource server id. Searches for resources without a resourceServer if null.
      type - the type of the resource
      owner - the resource owner or null for any resource with a given type
      consumer - the result consumer
    • findByTypeInstance

      public void findByTypeInstance(ResourceServer resourceServer, String type, Consumer<Resource> consumer)
      Description copied from interface: ResourceStore
      Finds all Resource by type where client represented by the resourceServer is not the owner
      Specified by:
      findByTypeInstance in interface ResourceStore
      Parameters:
      resourceServer - the resourceServer. Searches for resources without a resourceServer if null.
      type - searched type
      consumer - a consumer that will be fed with the resulting resources