org.keycloak.authorization.permission

## Class ResourcePermission

- java.lang.Object
- - org.keycloak.authorization.permission.ResourcePermission

-     public class ResourcePermission
      extends Object

  Represents a permission for a given resource.
  Author:
    Pedro Igor

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourcePermission(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer)`
    `ResourcePermission(Resource resource, Collection<Scope> scopes, ResourceServer resourceServer, Map<String,? extends Collection<String>> claims)`
    `ResourcePermission(Resource resource, ResourceServer resourceServer, Map<String,? extends Collection<String>> claims)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addClaim(String name, String value)` Adds a permission claim with the given name and a single value.
    `void` | `addClaims(Map<String,Set<String>> claims)`
    `void` | `addScope(Scope scope)`
    `Map<String,Set<String>>` | `getClaims()` Returns all permission claims.
    `Resource` | `getResource()` Returns the resource to which this permission applies.
    `ResourceServer` | `getResourceServer()` Returns the resource server associated with this permission.
    `Collection<Scope>` | `getScopes()` Returns a list of permitted scopes associated with the resource
    `boolean` | `isGranted()`
    `void` | `removeClaim(String name)` Removes a permission claim.
    `void` | `setGranted(boolean granted)`

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

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

- - ### Constructor Detail

    - #### ResourcePermission

          public ResourcePermission(Resource resource,
                                    Collection<Scope> scopes,
                                    ResourceServer resourceServer)

    - #### ResourcePermission

          public ResourcePermission(Resource resource,
                                    ResourceServer resourceServer,
                                    Map<String,? extends Collection<String>> claims)

    - #### ResourcePermission

          public ResourcePermission(Resource resource,
                                    Collection<Scope> scopes,
                                    ResourceServer resourceServer,
                                    Map<String,? extends Collection<String>> claims)

  - ### Method Detail

    - #### getResource

          public Resource getResource()

      Returns the resource to which this permission applies.
      Returns:
        the resource to which this permission applies

    - #### getScopes

          public Collection<Scope> getScopes()

      Returns a list of permitted scopes associated with the resource
      Returns:
        a lit of permitted scopes

    - #### getResourceServer

          public ResourceServer getResourceServer()

      Returns the resource server associated with this permission.
      Returns:
        the resource server

    - #### getClaims

          public Map<String,Set<String>> getClaims()

      Returns all permission claims.
      Returns:

    - #### addClaim

          public boolean addClaim(String name,
                                  String value)

      Adds a permission claim with the given name and a single value.

      If a claim already exists, the value is added to list of values of the existing claim

      Parameters:
        `name` - the name of the claim
        `value` - the value of the claim

    - #### removeClaim

          public void removeClaim(String name)

      Removes a permission claim.

      Parameters:
        `name` - the name of the claim

    - #### addScope

          public void addScope(Scope scope)

    - #### addClaims

          public void addClaims(Map<String,Set<String>> claims)

    - #### setGranted

          public void setGranted(boolean granted)

    - #### isGranted

          public boolean isGranted()

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