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 Modifier Constructor Description protected
PermissionTicketCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count(ResourceServer resourceServer, Map<PermissionTicket.FilterOption,String> attributes)
Returns count ofPermissionTicket
, filtered by the given attributes.PermissionTicket
create(ResourceServer resourceServer, Resource resource, Scope scope, String requester)
Creates a newPermissionTicket
instance.void
delete(String id)
Deletes a permission from the underlying persistence mechanism.List<PermissionTicket>
find(ResourceServer resourceServer, Map<PermissionTicket.FilterOption,String> attributes, Integer firstResult, Integer maxResult)
Returns a list ofPermissionTicket
, filtered by the given attributes.PermissionTicket
findById(ResourceServer resourceServer, String id)
Returns aPermissionTicket
with the givenid
List<PermissionTicket>
findByOwner(ResourceServer resourceServer, String owner)
Returns a list ofPermissionTicket
associated with the givenowner
.List<PermissionTicket>
findByResource(ResourceServer resourceServer, Resource resource)
Returns a list ofPermissionTicket
associated with theresource
.List<PermissionTicket>
findByResourceServer(ResourceServer resourceServer)
Returns a list ofPermissionTicket
associated with aResourceServer
.List<PermissionTicket>
findByScope(ResourceServer resourceServer, Scope scope)
Returns a list ofPermissionTicket
associated with thescope
.List<PermissionTicket>
findGranted(ResourceServer resourceServer, String userId)
Returns a list ofPermissionTicket
granted to the givenuserId
.List<PermissionTicket>
findGranted(ResourceServer resourceServer, String resourceName, String userId)
List<Resource>
findGrantedOwnerResources(String owner, Integer firstResult, Integer maxResults)
Returns a list ofResource
granted by the owner to other usersList<Resource>
findGrantedResources(String requester, String name, Integer first, Integer max)
Returns a list ofResource
granted to the givenrequester
-
-
-
Method Detail
-
count
public long count(ResourceServer resourceServer, Map<PermissionTicket.FilterOption,String> attributes)
Description copied from interface:PermissionTicketStore
Returns count ofPermissionTicket
, filtered by the given attributes.- Specified by:
count
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverattributes
- 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:PermissionTicketStore
Creates a newPermissionTicket
instance.- Specified by:
create
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource server to which this policy belongsresource
- resource idscope
- scope idrequester
- the policy representation- Returns:
- a new instance of
PermissionTicket
-
delete
public void delete(String id)
Description copied from interface:PermissionTicketStore
Deletes a permission from the underlying persistence mechanism.- Specified by:
delete
in interfacePermissionTicketStore
- Parameters:
id
- the id of the policy to delete
-
findById
public PermissionTicket findById(ResourceServer resourceServer, String id)
Description copied from interface:PermissionTicketStore
Returns aPermissionTicket
with the givenid
- Specified by:
findById
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverid
- the identifier of the permission- Returns:
- a permission with the given identifier.
-
findByResourceServer
public List<PermissionTicket> findByResourceServer(ResourceServer resourceServer)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
associated with aResourceServer
.- Specified by:
findByResourceServer
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource server- Returns:
- a list of permissions belonging to the given resource server
-
findByResource
public List<PermissionTicket> findByResource(ResourceServer resourceServer, Resource resource)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
associated with theresource
.- Specified by:
findByResource
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverresource
- the resource- Returns:
- a list of permissions associated with the given resource TODO: maybe we can get rid of reosourceServer param here as resource has method getResourceServer()
-
findByScope
public List<PermissionTicket> findByScope(ResourceServer resourceServer, Scope scope)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
associated with thescope
.- Specified by:
findByScope
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverscope
- the scope- Returns:
- a list of permissions associated with the given scopes TODO: maybe we can get rid of reosourceServer param here as resource has method getResourceServer()
-
find
public List<PermissionTicket> find(ResourceServer resourceServer, Map<PermissionTicket.FilterOption,String> attributes, Integer firstResult, Integer maxResult)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
, filtered by the given attributes.- Specified by:
find
in 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.FilterOption
firstResult
- 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
public List<PermissionTicket> findGranted(ResourceServer resourceServer, String userId)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
granted to the givenuserId
.- Specified by:
findGranted
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serveruserId
- 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:
findGranted
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverresourceName
- 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:PermissionTicketStore
Returns a list ofResource
granted to the givenrequester
- Specified by:
findGrantedResources
in 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
Resource
granted to the givenrequester
-
findGrantedOwnerResources
public List<Resource> findGrantedOwnerResources(String owner, Integer firstResult, Integer maxResults)
Description copied from interface:PermissionTicketStore
Returns a list ofResource
granted by the owner to other users- Specified by:
findGrantedOwnerResources
in 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
Resource
granted by the owner
-
findByOwner
public List<PermissionTicket> findByOwner(ResourceServer resourceServer, String owner)
Description copied from interface:PermissionTicketStore
Returns a list ofPermissionTicket
associated with the givenowner
.- Specified by:
findByOwner
in interfacePermissionTicketStore
- Parameters:
resourceServer
- the resource serverowner
- the identifier of a resource server- Returns:
- a list of permissions belonging to the given owner
-
-