org.keycloak.authorization.mongo.store

## Class MongoPolicyStore

- java.lang.Object
- - org.keycloak.authorization.mongo.store.MongoPolicyStore

- All Implemented Interfaces:
    PolicyStore

      public class MongoPolicyStore
      extends Object
      implements PolicyStore

  Author:
    Pedro Igor

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MongoPolicyStore(MongoStoreInvocationContext invocationContext, AuthorizationProvider authorizationProvider)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Policy` | `create(String name, String type, ResourceServer resourceServer)` Creates a new `Policy` instance.
    `void` | `delete(String id)` Deletes a policy from the underlying persistence mechanism.
    `Policy` | `findById(String id)` Returns a `Policy` with the given `id`
    `Policy` | `findByName(String name, String resourceServerId)` Returns a `Policy` with the given `name`
    `List<Policy>` | `findByResource(String resourceId)` Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `resourceId`.
    `List<Policy>` | `findByResourceServer(String resourceServerId)` Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
    `List<Policy>` | `findByResourceType(String resourceType, String resourceServerId)` Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `type`.
    `List<Policy>` | `findByScopeIds(List<String> scopeIds, String resourceServerId)` Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Scope` with the given `scopeIds`.
    `List<Policy>` | `findByType(String type)` Returns a list of `Policy` with the given `type`.
    `List<Policy>` | `findDependentPolicies(String policyId)` Returns a list of `Policy` that depends on another policy with the given `id`.

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

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

- - ### Constructor Detail

    - #### MongoPolicyStore

          public MongoPolicyStore(MongoStoreInvocationContext invocationContext,
                                  AuthorizationProvider authorizationProvider)

  - ### Method Detail

    - #### create

          public Policy create(String name,
                               String type,
                               ResourceServer resourceServer)

      Description copied from interface: `PolicyStore`
      Creates a new `Policy` instance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.
      Specified by:
        `create` in interface `PolicyStore`
      Parameters:
        `name` - the name of the policy
        `type` - the type of the policy
        `resourceServer` - the resource server to which this policy belongs
      Returns:
        a new instance of `Policy`

    - #### delete

          public void delete(String id)

      Description copied from interface: `PolicyStore`
      Deletes a policy from the underlying persistence mechanism.
      Specified by:
        `delete` in interface `PolicyStore`
      Parameters:
        `id` - the id of the policy to delete

    - #### findById

          public Policy findById(String id)

      Description copied from interface: `PolicyStore`
      Returns a `Policy` with the given `id`
      Specified by:
        `findById` in interface `PolicyStore`
      Parameters:
        `id` - the identifier of the policy
      Returns:
        a policy with the given identifier.

    - #### findByName

          public Policy findByName(String name,
                                   String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a `Policy` with the given `name`
      Specified by:
        `findByName` in interface `PolicyStore`
      Parameters:
        `name` - the name of the policy
        `resourceServerId` - the resource server id
      Returns:
        a policy with the given name.

    - #### findByResourceServer

          public List<Policy> findByResourceServer(String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `ResourceServer` with the given `resourceServerId`.
      Specified by:
        `findByResourceServer` in interface `PolicyStore`
      Parameters:
        `resourceServerId` - the identifier of a resource server
      Returns:
        a list of policies that belong to the given resource server

    - #### findByResource

          public List<Policy> findByResource(String resourceId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `resourceId`.
      Specified by:
        `findByResource` in interface `PolicyStore`
      Parameters:
        `resourceId` - the identifier of a resource
      Returns:
        a list of policies associated with the given resource

    - #### findByResourceType

          public List<Policy> findByResourceType(String resourceType,
                                                 String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Resource` with the given `type`.
      Specified by:
        `findByResourceType` in interface `PolicyStore`
      Parameters:
        `resourceType` - the type of a resource
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given resource type

    - #### findByScopeIds

          public List<Policy> findByScopeIds(List<String> scopeIds,
                                             String resourceServerId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` associated with a `org.keycloak.authorization.core.model.Scope` with the given `scopeIds`.
      Specified by:
        `findByScopeIds` in interface `PolicyStore`
      Parameters:
        `scopeIds` - the id of the scopes
        `resourceServerId` - the resource server id
      Returns:
        a list of policies associated with the given scopes

    - #### findByType

          public List<Policy> findByType(String type)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` with the given `type`.
      Specified by:
        `findByType` in interface `PolicyStore`
      Parameters:
        `type` - the type of the policy
      Returns:
        a list of policies with the given type

    - #### findDependentPolicies

          public List<Policy> findDependentPolicies(String policyId)

      Description copied from interface: `PolicyStore`
      Returns a list of `Policy` that depends on another policy with the given `id`.
      Specified by:
        `findDependentPolicies` in interface `PolicyStore`
      Parameters:
        `policyId` - the id of the policy to query its dependents
      Returns:
        a list of policies that depends on the a policy with the given identifier

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