org.keycloak.authorization.store

## Interface ResourceStore

- All Known Implementing Classes:
    JPAResourceStore, MapResourceStore, StoreFactoryCacheSession.ResourceCache

      public interface ResourceStore

  A `ResourceStore` is responsible to manage the persistence of `Resource` instances.
  Author:
    Pedro Igor

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default Resource` | `create(String name, ResourceServer resourceServer, String owner)` Creates a `Resource` instance backed by this persistent storage implementation.
    `Resource` | `create(String id, String name, ResourceServer resourceServer, String owner)` Creates a `Resource` instance backed by this persistent storage implementation.
    `void` | `delete(String id)` Removes a `Resource` instance, with the given `id` from the persistent storage.
    `Resource` | `findById(String id, String resourceServerId)` Returns a `Resource` instance based on its identifier.
    `Resource` | `findByName(String name, String resourceServerId)` Find a `Resource` by its name where the owner is the resource server itself.
    `Resource` | `findByName(String name, String ownerId, String resourceServerId)` Find a `Resource` by its name where the owner is the given `ownerId`.
    `default List<Resource>` | `findByOwner(String ownerId, String resourceServerId)` Finds all `Resource` instances with the given `ownerId`.
    `void` | `findByOwner(String ownerId, String resourceServerId, Consumer<Resource> consumer)`
    `List<Resource>` | `findByOwner(String ownerId, String resourceServerId, int first, int max)`
    `List<Resource>` | `findByResourceServer(Map<Resource.FilterOption,String[]> attributes, String resourceServerId, int firstResult, int maxResult)` Finds all `Resource` instances associated with a given resource server.
    `List<Resource>` | `findByResourceServer(String resourceServerId)` Finds all `Resource` instances associated with a given resource server.
    `default List<Resource>` | `findByScope(List<String> id, String resourceServerId)` Finds all `Resource` associated with a given scope.
    `void` | `findByScope(List<String> scopes, String resourceServerId, Consumer<Resource> consumer)`
    `default List<Resource>` | `findByType(String type, String resourceServerId)` Finds all `Resource` with the given type.
    `void` | `findByType(String type, String resourceServerId, Consumer<Resource> consumer)` Finds all `Resource` with the given type.
    `default List<Resource>` | `findByType(String type, String owner, String resourceServerId)` Finds all `Resource` with the given type.
    `void` | `findByType(String type, String owner, String resourceServerId, Consumer<Resource> consumer)` Finds all `Resource` with the given type.
    `default List<Resource>` | `findByTypeInstance(String type, String resourceServerId)`
    `void` | `findByTypeInstance(String type, String resourceServerId, Consumer<Resource> consumer)`
    `List<Resource>` | `findByUri(String uri, String resourceServerId)` Finds all `Resource` instances with the given uri.

- - ### Method Detail

    - #### create

          default Resource create(String name,
                                  ResourceServer resourceServer,
                                  String owner)

      Creates a `Resource` instance backed by this persistent storage implementation.

      Parameters:
        `name` - the name of this resource. It must be unique.
        `resourceServer` - the resource server to where the given resource belongs to
        `owner` - the owner of this resource or null if the resource server is the owner
      Returns:
        an instance backed by the underlying storage implementation

    - #### create

          Resource create(String id,
                          String name,
                          ResourceServer resourceServer,
                          String owner)

      Creates a `Resource` instance backed by this persistent storage implementation.

      Parameters:
        `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.
        `resourceServer` - the resource server to where the given resource belongs to
        `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

          void delete(String id)

      Removes a `Resource` instance, with the given `id` from the persistent storage.
      Parameters:
        `id` - the identifier of an existing resource instance

    - #### findById

          Resource findById(String id,
                            String resourceServerId)

      Returns a `Resource` instance based on its identifier.
      Parameters:
        `id` - the identifier of an existing resource instance
      Returns:
        the resource instance with the given identifier or null if no instance was found

    - #### findByOwner

          default List<Resource> findByOwner(String ownerId,
                                             String resourceServerId)

      Finds all `Resource` instances with the given `ownerId`.
      Parameters:
        `ownerId` - the identifier of the owner
      Returns:
        a list with all resource instances owned by the given owner

    - #### findByOwner

          void findByOwner(String ownerId,
                           String resourceServerId,
                           Consumer<Resource> consumer)

    - #### findByOwner

          List<Resource> findByOwner(String ownerId,
                                     String resourceServerId,
                                     int first,
                                     int max)

    - #### findByUri

          List<Resource> findByUri(String uri,
                                   String resourceServerId)

      Finds all `Resource` instances with the given uri.
      Parameters:
        `uri` - the identifier of the uri
      Returns:
        a list with all resource instances owned by the given owner

    - #### findByResourceServer

          List<Resource> findByResourceServer(String resourceServerId)

      Finds all `Resource` instances associated with a given resource server.
      Parameters:
        `resourceServerId` - the identifier of the resource server
      Returns:
        a list with all resources associated with the given resource server

    - #### findByResourceServer

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

      Finds all `Resource` instances associated with a given resource server.
      Parameters:
        `attributes` - a map holding the attributes that will be used as a filter; possible filter options are given by `Resource.FilterOption`
        `resourceServerId` - the identifier of the resource server
      Returns:
        a list with all resources associated with the given resource server
      Throws:
        `IllegalArgumentException` - when there is an unknown attribute in the `attributes` map

    - #### findByScope

          default List<Resource> findByScope(List<String> id,
                                             String resourceServerId)

      Finds all `Resource` associated with a given scope.
      Parameters:
        `id` - one or more scope identifiers
      Returns:
        a list of resources associated with the given scope(s)

    - #### findByScope

          void findByScope(List<String> scopes,
                           String resourceServerId,
                           Consumer<Resource> consumer)

    - #### findByName

          Resource findByName(String name,
                              String resourceServerId)

      Find a `Resource` by its name where the owner is the resource server itself.
      Parameters:
        `name` - the name of the resource
        `resourceServerId` - the identifier of the resource server
      Returns:
        a resource with the given name

    - #### findByName

          Resource findByName(String name,
                              String ownerId,
                              String resourceServerId)

      Find a `Resource` by its name where the owner is the given `ownerId`.
      Parameters:
        `name` - the name of the resource
        `ownerId` - the owner id
        `resourceServerId` - the identifier of the resource server
      Returns:
        a resource with the given name

    - #### findByType

          default List<Resource> findByType(String type,
                                            String resourceServerId)

      Finds all `Resource` with the given type.
      Parameters:
        `type` - the type of the resource
      Returns:
        a list of resources with the given type

    - #### findByType

          default List<Resource> findByType(String type,
                                            String owner,
                                            String resourceServerId)

      Finds all `Resource` with the given type.
      Parameters:
        `type` - the type of the resource
        `owner` - the resource owner or null for any resource with a given type
      Returns:
        a list of resources with the given type

    - #### findByType

          void findByType(String type,
                          String resourceServerId,
                          Consumer<Resource> consumer)

      Finds all `Resource` with the given type.
      Parameters:
        `type` - the type of the resource
        `resourceServerId` - the resource server id
        `consumer` - the result consumer

    - #### findByType

          void findByType(String type,
                          String owner,
                          String resourceServerId,
                          Consumer<Resource> consumer)

      Finds all `Resource` with the given type.
      Parameters:
        `type` - the type of the resource
        `owner` - the resource owner or null for any resource with a given type
        `resourceServerId` - the resource server id
        `consumer` - the result consumer

    - #### findByTypeInstance

          default List<Resource> findByTypeInstance(String type,
                                                    String resourceServerId)

    - #### findByTypeInstance

          void findByTypeInstance(String type,
                                  String resourceServerId,
                                  Consumer<Resource> consumer)

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