Class ProtectedResource
java.lang.Object
org.keycloak.authorization.client.resource.ProtectedResource
An entry point for managing resources using the Protection API.
- Author:
- Pedro Igor
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(ResourceRepresentation resource) Creates a new resource.void
Deletes a resource with the givenid
.<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.<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.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.Query the server for a resource given itsid
.findByMatchingUri
(String uri) Returns a list of resources that best matches the givenuri
.findByName
(String name) Query the server for a resource given itsname
where the owner is the resource server itself.findByName
(String name, String ownerId) Query the server for a resource given itsname
and a givenownerId
.Query the server for all resources with the given uri.void
update
(ResourceRepresentation resource) Updates a resource.
-
Method Details
-
create
Creates a new resource.- Parameters:
resource
- the resource data- Returns:
- a
RegistrationResponse
-
update
Updates a resource.- Parameters:
resource
- the resource data
-
findById
Query the server for a resource given itsid
.- Parameters:
id
- the resource id- Returns:
- a
ResourceRepresentation
-
findByName
Query the server for a resource given itsname
where the owner is the resource server itself.- Parameters:
name
- the resource name- Returns:
- a
ResourceRepresentation
-
findByName
Query the server for a resource given itsname
and a givenownerId
.- Parameters:
name
- the resource nameownerId
- the owner id- Returns:
- a
ResourceRepresentation
-
find
public 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 idname
- the resource nameuri
- the resource uriowner
- the resource ownertype
- the resource typescope
- the resource scopematchingUri
- the resource uri. Use this parameter to lookup a resource that best match the given urifirstResult
- the position of the first resource to retrievemaxResult
- the maximum number of resources to retrieve- Returns:
- an array of strings with the resource ids
-
find
public <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 idname
- the resource nameuri
- the resource uriowner
- the resource ownertype
- the resource typescope
- the resource scopematchingUri
- the resource uri. Use this parameter to lookup a resource that best match the given urideep
- if the result should be a list of resource representations with details about the resource. If false, only ids are returnedfirstResult
- the position of the first resource to retrievemaxResult
- 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
-
find
public <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 idname
- the resource nameuri
- the resource uriowner
- the resource ownertype
- the resource typescope
- the resource scopematchingUri
- the resource uri. Use this parameter to lookup a resource that best match the given uriexactName
- if the thename
provided should have a exact matchdeep
- if the result should be a list of resource representations with details about the resource. If false, only ids are returnedfirstResult
- the position of the first resource to retrievemaxResult
- 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
-
findAll
Query the server for all resources.- Returns:
-
delete
Deletes a resource with the givenid
.- Parameters:
id
- the resource id
-
findByUri
Query the server for all resources with the given uri.- Parameters:
uri
- the resource uri
-
findByMatchingUri
Returns a list of resources that best matches the givenuri
. This method queries the server for resources whoseResourceRepresentation#uri
best matches the givenuri
.- Parameters:
uri
- the resource uri to match- Returns:
- a list of resources
-