public class JPAPolicyStore extends Object implements PolicyStore
Constructor and Description |
---|
JPAPolicyStore(javax.persistence.EntityManager entityManager,
AuthorizationProvider provider) |
Modifier and Type | Method and Description |
---|---|
Policy |
create(AbstractPolicyRepresentation representation,
ResourceServer resourceServer)
Creates a new
Policy instance. |
void |
delete(String id)
Deletes a policy from the underlying persistence mechanism.
|
Policy |
findById(String id,
String resourceServerId)
Returns a
Policy with the given id |
Policy |
findByName(String name,
String resourceServerId)
Returns a
Policy with the given name |
void |
findByResource(String resourceId,
String resourceServerId,
Consumer<Policy> consumer) |
List<Policy> |
findByResourceServer(Map<Policy.FilterOption,String[]> attributes,
String resourceServerId,
int firstResult,
int maxResult)
|
List<Policy> |
findByResourceServer(String resourceServerId)
|
void |
findByResourceType(String resourceType,
String resourceServerId,
Consumer<Policy> consumer) |
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 . |
void |
findByScopeIds(List<String> scopeIds,
String resourceId,
String resourceServerId,
Consumer<Policy> consumer)
Effectively the same method as
PolicyStore.findByScopeIds(List, String, String) , however in the end
the consumer is fed with the result. |
List<Policy> |
findByType(String type,
String resourceServerId)
Returns a list of
Policy with the given type . |
List<Policy> |
findDependentPolicies(String policyId,
String resourceServerId)
Returns a list of
Policy that depends on another policy with the given id . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findByResource, findByResourceType, findByScopeIds
public JPAPolicyStore(javax.persistence.EntityManager entityManager, AuthorizationProvider provider)
public Policy create(AbstractPolicyRepresentation representation, ResourceServer resourceServer)
PolicyStore
Policy
instance. The new instance is not necessarily persisted though, which may require
a call to the {#save} method to actually make it persistent.create
in interface PolicyStore
representation
- the policy representationresourceServer
- the resource server to which this policy belongsPolicy
public void delete(String id)
PolicyStore
delete
in interface PolicyStore
id
- the id of the policy to deletepublic Policy findById(String id, String resourceServerId)
PolicyStore
Policy
with the given id
findById
in interface PolicyStore
id
- the identifier of the policyresourceServerId
- the resource server idpublic Policy findByName(String name, String resourceServerId)
PolicyStore
Policy
with the given name
findByName
in interface PolicyStore
name
- the name of the policyresourceServerId
- the resource server idpublic List<Policy> findByResourceServer(String resourceServerId)
PolicyStore
findByResourceServer
in interface PolicyStore
resourceServerId
- the identifier of a resource serverpublic List<Policy> findByResourceServer(Map<Policy.FilterOption,String[]> attributes, String resourceServerId, int firstResult, int maxResult)
PolicyStore
findByResourceServer
in interface PolicyStore
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 serverpublic void findByResource(String resourceId, String resourceServerId, Consumer<Policy> consumer)
findByResource
in interface PolicyStore
public void findByResourceType(String resourceType, String resourceServerId, Consumer<Policy> consumer)
findByResourceType
in interface PolicyStore
public List<Policy> findByScopeIds(List<String> scopeIds, String resourceServerId)
PolicyStore
Policy
associated with a org.keycloak.authorization.core.model.Scope
with the given scopeIds
.findByScopeIds
in interface PolicyStore
scopeIds
- the id of the scopesresourceServerId
- the resource server idpublic void findByScopeIds(List<String> scopeIds, String resourceId, String resourceServerId, Consumer<Policy> consumer)
PolicyStore
PolicyStore.findByScopeIds(List, String, String)
, however in the end
the consumer
is fed with the result.findByScopeIds
in interface PolicyStore
public List<Policy> findByType(String type, String resourceServerId)
PolicyStore
Policy
with the given type
.findByType
in interface PolicyStore
type
- the type of the policyresourceServerId
- the resource server idpublic List<Policy> findDependentPolicies(String policyId, String resourceServerId)
PolicyStore
Policy
that depends on another policy with the given id
.findDependentPolicies
in interface PolicyStore
policyId
- the id of the policy to query its dependentsresourceServerId
- the resource server idCopyright © 2021 JBoss by Red Hat. All rights reserved.