org.keycloak.authorization.client.resource

## Class PermissionResource

- java.lang.Object
- - org.keycloak.authorization.client.resource.PermissionResource

-     public class PermissionResource
      extends Object

  An entry point for managing permission tickets using the Protection API.
  Author:
    Pedro Igor

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PermissionResource(Http http, ServerConfiguration serverConfiguration, TokenCallable pat)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `PermissionResponse` | `create(List<PermissionRequest> requests)` Creates a new permission ticket for a set of one or more resource and scope(s).
    `PermissionResponse` | `create(PermissionRequest request)` Creates a new permission ticket for a single resource and scope(s).
    `PermissionTicketRepresentation` | `create(PermissionTicketRepresentation ticket)` Creates a new uma permission for a single resource and scope(s).
    `void` | `delete(String ticketId)` Deletes a permission ticket by ID.
    `List<PermissionTicketRepresentation>` | `find(String resourceId, String scopeId, String owner, String requester, Boolean granted, Boolean returnNames, Integer firstResult, Integer maxResult)` Query the server for any permission ticket with the matching arguments.
    `List<PermissionTicketRepresentation>` | `findByResource(String resourceId)` Query the server for any permission ticket associated with the given `resourceId`.
    `List<PermissionTicketRepresentation>` | `findByScope(String scopeId)` Query the server for any permission ticket associated with the given `scopeId`.
    `PermissionResponse` | `forResource(PermissionRequest request)` Deprecated. use `create(PermissionRequest)`
    `void` | `update(PermissionTicketRepresentation ticket)` Updates a permission ticket.

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

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

- - ### Constructor Detail

    - #### PermissionResource

          public PermissionResource(Http http,
                                    ServerConfiguration serverConfiguration,
                                    TokenCallable pat)

  - ### Method Detail

    - #### forResource

          @Deprecated
          public PermissionResponse forResource(PermissionRequest request)

      Deprecated. use `create(PermissionRequest)`
      Parameters:
        `request` -
      Returns:

    - #### create

          public PermissionResponse create(PermissionRequest request)

      Creates a new permission ticket for a single resource and scope(s).
      Parameters:
        `request` - the `PermissionRequest` representing the resource and scope(s) (not `null`)
      Returns:
        a permission response holding a permission ticket with the requested permissions

    - #### create

          public PermissionResponse create(List<PermissionRequest> requests)

      Creates a new permission ticket for a set of one or more resource and scope(s).
      Parameters:
        `requests` - the `PermissionRequest` representing the resource and scope(s) (not `null`)
      Returns:
        a permission response holding a permission ticket with the requested permissions

    - #### create

          public PermissionTicketRepresentation create(PermissionTicketRepresentation ticket)

      Creates a new uma permission for a single resource and scope(s).
      Parameters:
        `ticket` - the `PermissionTicketRepresentation` representing the resource and scope(s) (not `null`)
      Returns:
        a permission response holding the permission ticket representation

    - #### findByScope

          public List<PermissionTicketRepresentation> findByScope(String scopeId)

      Query the server for any permission ticket associated with the given `scopeId`.
      Parameters:
        `scopeId` - the scope id (not `null`)
      Returns:
        a list of permission tickets associated with the given `scopeId`

    - #### findByResource

          public List<PermissionTicketRepresentation> findByResource(String resourceId)

      Query the server for any permission ticket associated with the given `resourceId`.
      Parameters:
        `resourceId` - the resource id (not `null`)
      Returns:
        a list of permission tickets associated with the given `resourceId`

    - #### find

          public List<PermissionTicketRepresentation> find(String resourceId,
                                                           String scopeId,
                                                           String owner,
                                                           String requester,
                                                           Boolean granted,
                                                           Boolean returnNames,
                                                           Integer firstResult,
                                                           Integer maxResult)

      Query the server for any permission ticket with the matching arguments.
      Parameters:
        `resourceId` - the resource id or name
        `scopeId` - the scope id or name
        `owner` - the owner id or name
        `requester` - the requester id or name
        `granted` - if true, only permission tickets marked as granted are returned.
        `returnNames` - if the response should include names for resource, scope and owner
        `firstResult` - the position of the first resource to retrieve
        `maxResult` - the maximum number of resources to retrieve
      Returns:
        a list of permission tickets with the matching arguments

    - #### update

          public void update(PermissionTicketRepresentation ticket)

      Updates a permission ticket.
      Parameters:
        `ticket` - the permission ticket

    - #### delete

          public void delete(String ticketId)

      Deletes a permission ticket by ID.
      Parameters:
        `ticketId` - the permission ticket ID

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