Interface PolicyStore

    • Method Detail

      • create

        Policy create​(AbstractPolicyRepresentation representation,
                      ResourceServer resourceServer)
        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.
        Parameters:
        representation - the policy representation
        resourceServer - the resource server to which this policy belongs
        Returns:
        a new instance of Policy
      • delete

        void delete​(String id)
        Deletes a policy from the underlying persistence mechanism.
        Parameters:
        id - the id of the policy to delete
      • findById

        Policy findById​(String id,
                        String resourceServerId)
        Returns a Policy with the given id
        Parameters:
        id - the identifier of the policy
        resourceServerId - the resource server id
        Returns:
        a policy with the given identifier.
      • findByName

        Policy findByName​(String name,
                          String resourceServerId)
        Returns a Policy with the given name
        Parameters:
        name - the name of the policy
        resourceServerId - the resource server id
        Returns:
        a policy with the given name.
      • findByResourceServer

        List<Policy> findByResourceServer​(String resourceServerId)
        Returns a list of Policy associated with a ResourceServer with the given resourceServerId.
        Parameters:
        resourceServerId - the identifier of a resource server
        Returns:
        a list of policies that belong to the given resource server
      • findByResourceServer

        List<Policy> findByResourceServer​(Map<Policy.FilterOption,​String[]> attributes,
                                          String resourceServerId,
                                          int firstResult,
                                          int maxResult)
        Returns a list of Policy associated with a ResourceServer with the given resourceServerId.
        Parameters:
        attributes - a map holding the attributes that will be used as a filter; possible filter options are given by Policy.FilterOption
        resourceServerId - the identifier of a resource server
        Returns:
        a list of policies that belong to the given resource server
        Throws:
        IllegalArgumentException - when there is an unknown attribute in the attributes map
      • findByResource

        default List<Policy> findByResource​(String resourceId,
                                            String resourceServerId)
        Returns a list of Policy 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 policies associated with the given resource
      • findByResourceType

        default 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.
        Parameters:
        resourceType - the type of a resource
        resourceServerId - the resource server id
        Returns:
        a list of policies associated with the given resource type
      • findByScopeIds

        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.
        Parameters:
        scopeIds - the id of the scopes
        resourceServerId - the resource server id
        Returns:
        a list of policies associated with the given scopes
      • findByScopeIds

        default List<Policy> findByScopeIds​(List<String> scopeIds,
                                            String resourceId,
                                            String resourceServerId)
        Returns a list of Policy associated with a org.keycloak.authorization.core.model.Scope with the given resourceId and scopeIds.
        Parameters:
        scopeIds - the id of the scopes
        resourceId - the id of the resource. Ignored if null.
        resourceServerId - the resource server id
        Returns:
        a list of policies associated with the given scopes
      • findByType

        List<Policy> findByType​(String type,
                                String resourceServerId)
        Returns a list of Policy with the given type.
        Parameters:
        type - the type of the policy
        resourceServerId - the resource server id
        Returns:
        a list of policies with the given type
      • findDependentPolicies

        List<Policy> findDependentPolicies​(String id,
                                           String resourceServerId)
        Returns a list of Policy that depends on another policy with the given id.
        Parameters:
        id - the id of the policy to query its dependents
        resourceServerId - the resource server id
        Returns:
        a list of policies that depends on the a policy with the given identifier