Class StoreFactoryCacheSession.PermissionTicketCache
java.lang.Object
org.keycloak.models.cache.infinispan.authorization.StoreFactoryCacheSession.PermissionTicketCache
- All Implemented Interfaces:
PermissionTicketStore
- Enclosing class:
- StoreFactoryCacheSession
protected class StoreFactoryCacheSession.PermissionTicketCache
extends Object
implements PermissionTicketStore
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcount(ResourceServer resourceServer, Map<PermissionTicket.FilterOption, String> attributes) Returns count ofPermissionTicket, filtered by the given attributes.create(ResourceServer resourceServer, Resource resource, Scope scope, String requester) Creates a newPermissionTicketinstance.voidDeletes a permission from the underlying persistence mechanism.find(ResourceServer resourceServer, Map<PermissionTicket.FilterOption, String> attributes, Integer firstResult, Integer maxResult) Returns a list ofPermissionTicket, filtered by the given attributes.findById(ResourceServer resourceServer, String id) Returns aPermissionTicketwith the givenidfindByResource(ResourceServer resourceServer, Resource resource) Returns a list ofPermissionTicketassociated with theresource.findByScope(ResourceServer resourceServer, Scope scope) Returns a list ofPermissionTicketassociated with thescope.findGranted(ResourceServer resourceServer, String userId) Returns a list ofPermissionTicketgranted to the givenuserId.findGranted(ResourceServer resourceServer, String resourceName, String userId) findGrantedOwnerResources(String owner, Integer firstResult, Integer maxResults) Returns a list ofResourcegranted by the owner to other usersfindGrantedResources(String requester, String name, Integer first, Integer max) Returns a list ofResourcegranted to the givenrequester
-
Constructor Details
-
PermissionTicketCache
protected PermissionTicketCache()
-
-
Method Details
-
count
public long count(ResourceServer resourceServer, Map<PermissionTicket.FilterOption, String> attributes) Description copied from interface:PermissionTicketStoreReturns count ofPermissionTicket, filtered by the given attributes.- Specified by:
countin interfacePermissionTicketStore- Parameters:
resourceServer- the resource server.attributes- permission tickets that do not match the attributes are not included with the count; possible filter options are given byPermissionTicket.FilterOption- Returns:
- an integer indicating the amount of permission tickets
-
create
public PermissionTicket create(ResourceServer resourceServer, Resource resource, Scope scope, String requester) Description copied from interface:PermissionTicketStoreCreates a newPermissionTicketinstance.- Specified by:
createin interfacePermissionTicketStore- Parameters:
resourceServer- the resource server to which this permission ticket belongs. Cannot benull.resource- resource. Cannot benull.scope- scope.requester- requester of the permission- Returns:
- a new instance of
PermissionTicket
-
delete
Description copied from interface:PermissionTicketStoreDeletes a permission from the underlying persistence mechanism.- Specified by:
deletein interfacePermissionTicketStore- Parameters:
id- the id of the policy to delete
-
findById
Description copied from interface:PermissionTicketStoreReturns aPermissionTicketwith the givenid- Specified by:
findByIdin interfacePermissionTicketStore- Parameters:
resourceServer- the resource server. Ignored ifnull.id- the identifier of the permission- Returns:
- a permission with the given identifier.
-
findByResource
Description copied from interface:PermissionTicketStoreReturns a list ofPermissionTicketassociated with theresource.- Specified by:
findByResourcein interfacePermissionTicketStore- Parameters:
resourceServer- the resource server. Cannot benull.resource- the resource. Cannot benull- Returns:
- a list of permissions associated with the given resource
-
findByScope
Description copied from interface:PermissionTicketStoreReturns a list ofPermissionTicketassociated with thescope.- Specified by:
findByScopein interfacePermissionTicketStore- Parameters:
resourceServer- the resource server. Cannot benull.scope- the scope. Cannot benull.- Returns:
- a list of permissions associated with the given scopes
-
find
public List<PermissionTicket> find(ResourceServer resourceServer, Map<PermissionTicket.FilterOption, String> attributes, Integer firstResult, Integer maxResult) Description copied from interface:PermissionTicketStoreReturns a list ofPermissionTicket, filtered by the given attributes.- Specified by:
findin interfacePermissionTicketStore- Parameters:
resourceServer- a resource server that resulting tickets should belong to. Ignored ifnull.attributes- a map of keys and values to filter on; possible filter options are given byPermissionTicket.FilterOptionfirstResult- first result to return. Ignored if negative ornull.maxResult- maximum number of results to return. Ignored if negative ornull.- Returns:
- a list of filtered and paginated permissions
-
findGranted
Description copied from interface:PermissionTicketStoreReturns a list ofPermissionTicketgranted to the givenuserId.- Specified by:
findGrantedin interfacePermissionTicketStore- Parameters:
resourceServer- the resource server. Cannot benulluserId- the user id- Returns:
- a list of permissions granted for a particular user
-
findGranted
public List<PermissionTicket> findGranted(ResourceServer resourceServer, String resourceName, String userId) Description copied from interface:PermissionTicketStore- Specified by:
findGrantedin interfacePermissionTicketStore- Parameters:
resourceServer- the resource server. Cannot benull.resourceName- the name of a resourceuserId- the user id- Returns:
- a list of permissions granted for a particular user TODO: investigate a way how to replace resourceName with Resource class
-
findGrantedResources
public List<Resource> findGrantedResources(String requester, String name, Integer first, Integer max) Description copied from interface:PermissionTicketStoreReturns a list ofResourcegranted to the givenrequester- Specified by:
findGrantedResourcesin interfacePermissionTicketStore- Parameters:
requester- the requestername- the keyword to query resources by name or null if any resourcefirst- first result to return. Ignored if negative ornull.max- maximum number of results to return. Ignored if negative ornull.- Returns:
- a list of
Resourcegranted to the givenrequester
-
findGrantedOwnerResources
public List<Resource> findGrantedOwnerResources(String owner, Integer firstResult, Integer maxResults) Description copied from interface:PermissionTicketStoreReturns a list ofResourcegranted by the owner to other users- Specified by:
findGrantedOwnerResourcesin interfacePermissionTicketStore- Parameters:
owner- the ownerfirstResult- first result to return. Ignored if negative ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a list of
Resourcegranted by the owner
-