Package org.keycloak.authorization.store
Interface PermissionTicketStore
-
public interface PermissionTicketStoreAPermissionTicketStoreis responsible to manage the persistence ofPermissionTicketinstances.- Author:
- Pedro Igor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcount(Map<PermissionTicket.FilterOption,String> attributes, String resourceServerId)Returns count ofPermissionTicket, filtered by the given attributes.PermissionTicketcreate(String resourceId, String scopeId, String requester, ResourceServer resourceServer)Creates a newPermissionTicketinstance.voiddelete(String id)Deletes a permission from the underlying persistence mechanism.List<PermissionTicket>find(Map<PermissionTicket.FilterOption,String> attributes, String resourceServerId, int firstResult, int maxResult)Returns a list ofPermissionTicket, filtered by the given attributes.PermissionTicketfindById(String id, String resourceServerId)Returns aPermissionTicketwith the givenidList<PermissionTicket>findByOwner(String owner, String resourceServerId)Returns a list ofPermissionTicketassociated with the givenowner.List<PermissionTicket>findByResource(String resourceId, String resourceServerId)Returns a list ofPermissionTicketassociated with aorg.keycloak.authorization.core.model.Resourcewith the givenresourceId.List<PermissionTicket>findByResourceServer(String resourceServerId)Returns a list ofPermissionTicketassociated with aResourceServerwith the givenresourceServerId.List<PermissionTicket>findByScope(String scopeId, String resourceServerId)Returns a list ofPermissionTicketassociated with aorg.keycloak.authorization.core.model.Scopewith the givenscopeId.List<PermissionTicket>findGranted(String userId, String resourceServerId)Returns a list ofPermissionTicketgranted to the givenuserId.List<PermissionTicket>findGranted(String resourceName, String userId, String resourceServerId)List<Resource>findGrantedOwnerResources(String owner, int first, int max)Returns a list ofResourcegranted by the owner to other usersList<Resource>findGrantedResources(String requester, String name, int first, int max)Returns a list ofResourcegranted to the givenrequester
-
-
-
Method Detail
-
count
long count(Map<PermissionTicket.FilterOption,String> attributes, String resourceServerId)
Returns count ofPermissionTicket, filtered by the given attributes.- Parameters:
attributes- permission tickets that do not match the attributes are not included with the count; possible filter options are given byPermissionTicket.FilterOptionresourceServerId- the resource server id- Returns:
- an integer indicating the amount of permission tickets
- Throws:
IllegalArgumentException- when there is an unknown attribute in theattributesmap
-
create
PermissionTicket create(String resourceId, String scopeId, String requester, ResourceServer resourceServer)
Creates a newPermissionTicketinstance.- Parameters:
permission- the policy representationresourceServer- the resource server to which this policy belongs- Returns:
- a new instance of
PermissionTicket
-
delete
void delete(String id)
Deletes a permission from the underlying persistence mechanism.- Parameters:
id- the id of the policy to delete
-
findById
PermissionTicket findById(String id, String resourceServerId)
Returns aPermissionTicketwith the givenid- Parameters:
id- the identifier of the permissionresourceServerId- the resource server id- Returns:
- a permission with the given identifier.
-
findByResourceServer
List<PermissionTicket> findByResourceServer(String resourceServerId)
Returns a list ofPermissionTicketassociated with aResourceServerwith the givenresourceServerId.- Parameters:
resourceServerId- the identifier of a resource server- Returns:
- a list of permissions belonging to the given resource server
-
findByOwner
List<PermissionTicket> findByOwner(String owner, String resourceServerId)
Returns a list ofPermissionTicketassociated with the givenowner.- Parameters:
owner- the identifier of a resource server- Returns:
- a list of permissions belonging to the given owner
-
findByResource
List<PermissionTicket> findByResource(String resourceId, String resourceServerId)
Returns a list ofPermissionTicketassociated with aorg.keycloak.authorization.core.model.Resourcewith the givenresourceId.- Parameters:
resourceId- the identifier of a resourceresourceServerId- the resource server id- Returns:
- a list of permissions associated with the given resource
-
findByScope
List<PermissionTicket> findByScope(String scopeId, String resourceServerId)
Returns a list ofPermissionTicketassociated with aorg.keycloak.authorization.core.model.Scopewith the givenscopeId.- Parameters:
scopeId- the id of the scopesresourceServerId- the resource server id- Returns:
- a list of permissions associated with the given scopes
-
find
List<PermissionTicket> find(Map<PermissionTicket.FilterOption,String> attributes, String resourceServerId, int firstResult, int maxResult)
Returns a list ofPermissionTicket, filtered by the given attributes.- Parameters:
attributes- a map of keys and values to filter on; possible filter options are given byPermissionTicket.FilterOptionresourceServerId- an id of resource server that resulting tickets should belong to. Ignored ifnullfirstResult- first result to return; Ignored if negative or zeromaxResult- maximum number of results to return; Ignored if negative- Returns:
- a list of filtered and paginated permissions
- Throws:
IllegalArgumentException- when there is an unknown attribute in theattributesmap
-
findGranted
List<PermissionTicket> findGranted(String userId, String resourceServerId)
Returns a list ofPermissionTicketgranted to the givenuserId.- Parameters:
userId- the user idresourceServerId- the resource server id- Returns:
- a list of permissions granted for a particular user
-
findGranted
List<PermissionTicket> findGranted(String resourceName, String userId, String resourceServerId)
- Parameters:
resourceName- the name of a resourceuserId- the user idresourceServerId- the resource server id- Returns:
- a list of permissions granted for a particular user
-
findGrantedResources
List<Resource> findGrantedResources(String requester, String name, int first, int max)
Returns a list ofResourcegranted to the givenrequester- Parameters:
requester- the requestername- the keyword to query resources by name or null if any resourcefirst- first resultmax- max result- Returns:
- a list of
Resourcegranted to the givenrequester
-
-