org.keycloak.authorization.store

## Interface PermissionTicketStore

- All Known Implementing Classes:
    JPAPermissionTicketStore, StoreFactoryCacheSession.PermissionTicketCache

      public interface PermissionTicketStore

  A `PermissionTicketStore` is responsible to manage the persistence of `PermissionTicket` instances.
  Author:
    Pedro Igor

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `PermissionTicket` | `create(String resourceId, String scopeId, String requester, ResourceServer resourceServer)` Creates a new `PermissionTicket` instance.
    `void` | `delete(String id)` Deletes a permission from the underlying persistence mechanism.
    `List<PermissionTicket>` | `find(Map<String,String> attributes, String resourceServerId, int firstResult, int maxResult)`
    `PermissionTicket` | `findById(String id, String resourceServerId)` Returns a `PermissionTicket` with the given `id`
    `List<PermissionTicket>` | `findByOwner(String owner, String resourceServerId)` Returns a list of `PermissionTicket` associated with the given `owner`.
    `List<PermissionTicket>` | `findByResource(String resourceId, String resourceServerId)` Returns a list of `PermissionTicket` associated with a `org.keycloak.authorization.core.model.Resource` with the given `resourceId`.
    `List<PermissionTicket>` | `findByResourceServer(String resourceServerId)` Returns a list of `PermissionTicket` associated with a `ResourceServer` with the given `resourceServerId`.
    `List<PermissionTicket>` | `findByScope(String scopeId, String resourceServerId)` Returns a list of `PermissionTicket` associated with a `org.keycloak.authorization.core.model.Scope` with the given `scopeId`.
    `List<PermissionTicket>` | `findGranted(String userId, String resourceServerId)` Returns a list of `PermissionTicket` granted to the given `userId`.
    `List<PermissionTicket>` | `findGranted(String resourceName, String userId, String resourceServerId)` Returns a list of `PermissionTicket` with name equal to `resourceName` granted to the given `userId`.
    `List<Resource>` | `findGrantedOwnerResources(String owner, int first, int max)` Returns a list of `Resource` granted by the owner to other users
    `List<Resource>` | `findGrantedResources(String requester, String name, int first, int max)` Returns a list of `Resource` granted to the given `requester`

- - ### Method Detail

    - #### create

          PermissionTicket create(String resourceId,
                                  String scopeId,
                                  String requester,
                                  ResourceServer resourceServer)

      Creates a new `PermissionTicket` instance.
      Parameters:
        `permission` - the policy representation
        `resourceServer` - the resource server to which this policy belongs
      Returns:
        a new instance of `PermissionTicket`

    - #### delete

          void delete(String id)

      Deletes a permission from the underlying persistence mechanism.
      Parameters:
        `id` - the id of the policy to delete

    - #### findById

          PermissionTicket findById(String id,
                                    String resourceServerId)

      Returns a `PermissionTicket` with the given `id`
      Parameters:
        `id` - the identifier of the permission
        `resourceServerId` - the resource server id
      Returns:
        a permission with the given identifier.

    - #### findByResourceServer

          List<PermissionTicket> findByResourceServer(String resourceServerId)

      Returns a list of `PermissionTicket` associated with a `ResourceServer` with the given `resourceServerId`.
      Parameters:
        `resourceServerId` - the identifier of a resource server
      Returns:
        a list of permissions belonging to the given resource server

    - #### findByOwner

          List<PermissionTicket> findByOwner(String owner,
                                             String resourceServerId)

      Returns a list of `PermissionTicket` associated with the given `owner`.
      Parameters:
        `owner` - the identifier of a resource server
      Returns:
        a list of permissions belonging to the given owner

    - #### findByResource

          List<PermissionTicket> findByResource(String resourceId,
                                                String resourceServerId)

      Returns a list of `PermissionTicket` associated with a `org.keycloak.authorization.core.model.Resource` with the given `resourceId`.
      Parameters:
        `resourceId` - the identifier of a resource
        `resourceServerId` - the resource server id
      Returns:
        a list of permissions associated with the given resource

    - #### findByScope

          List<PermissionTicket> findByScope(String scopeId,
                                             String resourceServerId)

      Returns a list of `PermissionTicket` associated with a `org.keycloak.authorization.core.model.Scope` with the given `scopeId`.
      Parameters:
        `scopeId` - the id of the scopes
        `resourceServerId` - the resource server id
      Returns:
        a list of permissions associated with the given scopes

    - #### find

          List<PermissionTicket> find(Map<String,String> attributes,
                                      String resourceServerId,
                                      int firstResult,
                                      int maxResult)

    - #### findGranted

          List<PermissionTicket> findGranted(String userId,
                                             String resourceServerId)

      Returns a list of `PermissionTicket` granted to the given `userId`.
      Parameters:
        `userId` - the user id
        `resourceServerId` - the resource server id
      Returns:
        a list of permissions granted for a particular user

    - #### findGranted

          List<PermissionTicket> findGranted(String resourceName,
                                             String userId,
                                             String resourceServerId)

      Returns a list of `PermissionTicket` with name equal to `resourceName` granted to the given `userId`.
      Parameters:
        `resourceName` - the name of a resource
        `userId` - the user id
        `resourceServerId` - the resource server id
      Returns:
        a list of permissions granted for a particular user

    - #### findGrantedResources

          List<Resource> findGrantedResources(String requester,
                                              String name,
                                              int first,
                                              int max)

      Returns a list of `Resource` granted to the given `requester`
      Parameters:
        `requester` - the requester
        `name` - the keyword to query resources by name or null if any resource
        `first` - first result
        `max` - max result
      Returns:
        a list of `Resource` granted to the given `requester`

    - #### findGrantedOwnerResources

          List<Resource> findGrantedOwnerResources(String owner,
                                                   int first,
                                                   int max)

      Returns a list of `Resource` granted by the owner to other users
      Parameters:
        `owner` - the owner
        `first` - first result
        `max` - max result
      Returns:
        a list of `Resource` granted by the owner

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