Class ProtectedResource
- java.lang.Object
- 
- org.keycloak.authorization.client.resource.ProtectedResource
 
- 
 public class ProtectedResource extends Object An entry point for managing resources using the Protection API.- Author:
- Pedro Igor
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceRepresentationcreate(ResourceRepresentation resource)Creates a new resource.voiddelete(String id)Deletes a resource with the givenid.<R> Rfind(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, boolean exactName, boolean deep, Integer firstResult, Integer maxResult)Query the server for any resource with the matching arguments.<R> Rfind(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, boolean deep, Integer firstResult, Integer maxResult)Query the server for any resource with the matching arguments, where queries by name are partial.String[]find(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, Integer firstResult, Integer maxResult)Query the server for any resource with the matching arguments.String[]findAll()Query the server for all resources.ResourceRepresentationfindById(String id)Query the server for a resource given itsid.List<ResourceRepresentation>findByMatchingUri(String uri)Returns a list of resources that best matches the givenuri.ResourceRepresentationfindByName(String name)Query the server for a resource given itsnamewhere the owner is the resource server itself.ResourceRepresentationfindByName(String name, String ownerId)Query the server for a resource given itsnameand a givenownerId.List<ResourceRepresentation>findByUri(String uri)Query the server for all resources with the given uri.voidupdate(ResourceRepresentation resource)Updates a resource.
 
- 
- 
- 
Method Detail- 
createpublic ResourceRepresentation create(ResourceRepresentation resource) Creates a new resource.- Parameters:
- resource- the resource data
- Returns:
- a RegistrationResponse
 
 - 
updatepublic void update(ResourceRepresentation resource) Updates a resource.- Parameters:
- resource- the resource data
 
 - 
findByIdpublic ResourceRepresentation findById(String id) Query the server for a resource given itsid.- Parameters:
- id- the resource id
- Returns:
- a ResourceRepresentation
 
 - 
findByNamepublic ResourceRepresentation findByName(String name) Query the server for a resource given itsnamewhere the owner is the resource server itself.- Parameters:
- name- the resource name
- Returns:
- a ResourceRepresentation
 
 - 
findByNamepublic ResourceRepresentation findByName(String name, String ownerId) Query the server for a resource given itsnameand a givenownerId.- Parameters:
- name- the resource name
- ownerId- the owner id
- Returns:
- a ResourceRepresentation
 
 - 
findpublic String[] find(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, Integer firstResult, Integer maxResult) Query the server for any resource with the matching arguments.- Parameters:
- id- the resource id
- name- the resource name
- uri- the resource uri
- owner- the resource owner
- type- the resource type
- scope- the resource scope
- matchingUri- the resource uri. Use this parameter to lookup a resource that best match the given uri
- firstResult- the position of the first resource to retrieve
- maxResult- the maximum number of resources to retrieve
- Returns:
- an array of strings with the resource ids
 
 - 
findpublic <R> R find(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, boolean deep, Integer firstResult, Integer maxResult) Query the server for any resource with the matching arguments, where queries by name are partial. - Parameters:
- id- the resource id
- name- the resource name
- uri- the resource uri
- owner- the resource owner
- type- the resource type
- scope- the resource scope
- matchingUri- the resource uri. Use this parameter to lookup a resource that best match the given uri
- deep- if the result should be a list of resource representations with details about the resource. If false, only ids are returned
- firstResult- the position of the first resource to retrieve
- maxResult- the maximum number of resources to retrieve
- Returns:
- a list of resource representations or an array of strings representing resource ids, depending on the generic type
 
 - 
findpublic <R> R find(String id, String name, String uri, String owner, String type, String scope, boolean matchingUri, boolean exactName, boolean deep, Integer firstResult, Integer maxResult) Query the server for any resource with the matching arguments.- Parameters:
- id- the resource id
- name- the resource name
- uri- the resource uri
- owner- the resource owner
- type- the resource type
- scope- the resource scope
- matchingUri- the resource uri. Use this parameter to lookup a resource that best match the given uri
- exactName- if the the- nameprovided should have a exact match
- deep- if the result should be a list of resource representations with details about the resource. If false, only ids are returned
- firstResult- the position of the first resource to retrieve
- maxResult- the maximum number of resources to retrieve
- Returns:
- a list of resource representations or an array of strings representing resource ids, depending on the generic type
 
 - 
findAllpublic String[] findAll() Query the server for all resources.- Returns:
 
 - 
deletepublic void delete(String id) Deletes a resource with the givenid.- Parameters:
- id- the resource id
 
 - 
findByUripublic List<ResourceRepresentation> findByUri(String uri) Query the server for all resources with the given uri.- Parameters:
- uri- the resource uri
 
 - 
findByMatchingUripublic List<ResourceRepresentation> findByMatchingUri(String uri) Returns a list of resources that best matches the givenuri. This method queries the server for resources whoseResourceRepresentation#uribest matches the givenuri.- Parameters:
- uri- the resource uri to match
- Returns:
- a list of resources
 
 
- 
 
-