Package com.unboundid.scim2.client
Class ScimService
- java.lang.Object
-
- com.unboundid.scim2.client.ScimService
-
- All Implemented Interfaces:
ScimInterface
public class ScimService extends Object implements ScimInterface
The main entry point to the client API used to access a SCIM 2 service provider.
-
-
Field Summary
Fields Modifier and Type Field Description static URI
ME_URI
The authenticated subject alias.static jakarta.ws.rs.core.MediaType
MEDIA_TYPE_SCIM_TYPE
The SCIM media type.
-
Constructor Summary
Constructors Constructor Description ScimService(jakarta.ws.rs.client.WebTarget baseTarget)
Create a new client instance to the SCIM 2 service provider at the provided WebTarget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ScimResource>
Tcreate(String endpoint, T resource)
Create the provided new SCIM resource at the service provider.<T extends ScimResource>
CreateRequestBuilder<T>createRequest(String endpoint, T resource)
Build a request to create the provided new SCIM resource at the service provider.void
delete(String endpoint, String id)
Delete a SCIM resource at the service provider.void
delete(URI url)
Delete a SCIM resource at the service provider.<T extends ScimResource>
voiddelete(T resource)
Delete a SCIM resource at the service provider.DeleteRequestBuilder
deleteRequest(String endpoint, String id)
Build a request to delete a SCIM resource at the service provider.DeleteRequestBuilder
deleteRequest(URI url)
Build a request to delete a SCIM resource at the service provider.<T extends ScimResource>
DeleteRequestBuilderdeleteRequest(T resource)
Build a request to delete a SCIM resource at the service provider.ResourceTypeResource
getResourceType(String name)
Retrieve a known resource type supported by the service provider.ListResponse<ResourceTypeResource>
getResourceTypes()
Retrieve the resource types supported by the service provider.SchemaResource
getSchema(String id)
Retrieve a known schema supported by the service provider.ListResponse<SchemaResource>
getSchemas()
Retrieve the schemas supported by the service provider.ServiceProviderConfigResource
getServiceProviderConfig()
Retrieve the service provider configuration.<T extends ScimResource>
Tmodify(String endpoint, String id, PatchRequest patchRequest, Class<T> clazz)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values.<T extends ScimResource>
Tmodify(T resource, PatchRequest patchRequest)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values.ModifyRequestBuilder.Typed
modifyRequest(String endpoint, String id)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values.ModifyRequestBuilder.Typed
modifyRequest(URI url)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values.<T extends ScimResource>
ModifyRequestBuilder.Generic<T>modifyRequest(T resource)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values.<T extends ScimResource>
Treplace(T resource)
Modify a SCIM resource by replacing the resource's attributes at the service provider.<T extends ScimResource>
ReplaceRequestBuilder<T>replaceRequest(URI uri, T resource)
Build a request to modify a SCIM resource by replacing the resource's attributes at the service provider.<T extends ScimResource>
ReplaceRequestBuilder<T>replaceRequest(T resource)
Build a request to modify a SCIM resource by replacing the resource's attributes at the service provider.<T extends ScimResource>
Tretrieve(String endpoint, String id, Class<T> cls)
Retrieve a known SCIM resource from the service provider.<T extends ScimResource>
Tretrieve(URI url, Class<T> cls)
Retrieve a known SCIM resource from the service provider.<T extends ScimResource>
Tretrieve(T resource)
Retrieve a known SCIM resource from the service provider.RetrieveRequestBuilder.Typed
retrieveRequest(String endpoint, String id)
Build a request to retrieve a known SCIM resource from the service provider.RetrieveRequestBuilder.Typed
retrieveRequest(URI url)
Build a request to retrieve a known SCIM resource from the service provider.<T extends ScimResource>
RetrieveRequestBuilder.Generic<T>retrieveRequest(T resource)
Build a request to retrieve a known SCIM resource from the service provider.<T extends ScimResource>
ListResponse<T>search(String endpoint, String filter, Class<T> clazz)
Search for SCIM resources matching the SCIM filter provided.SearchRequestBuilder
searchRequest(String endpoint)
Build a request to query and retrieve resources of a single resource type from the service provider.
-
-
-
Field Detail
-
MEDIA_TYPE_SCIM_TYPE
public static final jakarta.ws.rs.core.MediaType MEDIA_TYPE_SCIM_TYPE
The SCIM media type.
-
-
Constructor Detail
-
ScimService
public ScimService(jakarta.ws.rs.client.WebTarget baseTarget)
Create a new client instance to the SCIM 2 service provider at the provided WebTarget. The path of the WebTarget should be the base URI SCIM 2 service (i.e.,https://host/scim/v2
).- Parameters:
baseTarget
- The web target for the base URI of the SCIM 2 service provider.
-
-
Method Detail
-
getServiceProviderConfig
public ServiceProviderConfigResource getServiceProviderConfig() throws ScimException
Retrieve the service provider configuration.- Specified by:
getServiceProviderConfig
in interfaceScimInterface
- Returns:
- the service provider configuration.
- Throws:
ScimException
- if an error occurs.
-
getResourceTypes
public ListResponse<ResourceTypeResource> getResourceTypes() throws ScimException
Retrieve the resource types supported by the service provider.- Specified by:
getResourceTypes
in interfaceScimInterface
- Returns:
- The list of resource types supported by the service provider.
- Throws:
ScimException
- if an error occurs.
-
getResourceType
public ResourceTypeResource getResourceType(String name) throws ScimException
Retrieve a known resource type supported by the service provider.- Specified by:
getResourceType
in interfaceScimInterface
- Parameters:
name
- The name of the resource type.- Returns:
- The resource type with the provided name.
- Throws:
ScimException
- if an error occurs.
-
getSchemas
public ListResponse<SchemaResource> getSchemas() throws ScimException
Retrieve the schemas supported by the service provider.- Specified by:
getSchemas
in interfaceScimInterface
- Returns:
- The list of schemas supported by the service provider.
- Throws:
ScimException
- if an error occurs.
-
getSchema
public SchemaResource getSchema(String id) throws ScimException
Retrieve a known schema supported by the service provider.- Specified by:
getSchema
in interfaceScimInterface
- Parameters:
id
- The schema URN.- Returns:
- The resource type with the provided URN.
- Throws:
ScimException
- if an error occurs.
-
create
public <T extends ScimResource> T create(String endpoint, T resource) throws ScimException
Create the provided new SCIM resource at the service provider.- Specified by:
create
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups" as defined by the associated resource type.resource
- The new resource to create.- Returns:
- The successfully create SCIM resource.
- Throws:
ScimException
- if an error occurs.
-
retrieve
public <T extends ScimResource> T retrieve(String endpoint, String id, Class<T> cls) throws ScimException
Retrieve a known SCIM resource from the service provider.- Specified by:
retrieve
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).cls
- The Java class object used to determine the type to return.- Returns:
- The successfully retrieved SCIM resource.
- Throws:
ScimException
- if an error occurs.
-
retrieve
public <T extends ScimResource> T retrieve(URI url, Class<T> cls) throws ScimException
Retrieve a known SCIM resource from the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
url
- The URL of the resource to retrieve.cls
- The Java class object used to determine the type to return.- Returns:
- The successfully retrieved SCIM resource.
- Throws:
ScimException
- if an error occurs.
-
retrieve
public <T extends ScimResource> T retrieve(T resource) throws ScimException
Retrieve a known SCIM resource from the service provider. If the service provider supports resource versioning and the resource has not been modified, the provided resource will be returned.- Specified by:
retrieve
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to retrieve.- Returns:
- The successfully retrieved SCIM resource.
- Throws:
ScimException
- if an error occurs.
-
replace
public <T extends ScimResource> T replace(T resource) throws ScimException
Modify a SCIM resource by replacing the resource's attributes at the service provider. If the service provider supports resource versioning, the resource will only be modified if it has not been modified since it was retrieved.- Specified by:
replace
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The previously retrieved and revised resource.- Returns:
- The successfully replaced SCIM resource.
- Throws:
ScimException
- if an error occurs.
-
delete
public void delete(String endpoint, String id) throws ScimException
Delete a SCIM resource at the service provider.- Specified by:
delete
in interfaceScimInterface
- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).- Throws:
ScimException
- if an error occurs.
-
delete
public void delete(URI url) throws ScimException
Delete a SCIM resource at the service provider.- Parameters:
url
- The URL of the resource to delete.- Throws:
ScimException
- if an error occurs.
-
delete
public <T extends ScimResource> void delete(T resource) throws ScimException
Delete a SCIM resource at the service provider.- Specified by:
delete
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to delete.- Throws:
ScimException
- if an error occurs.
-
createRequest
public <T extends ScimResource> CreateRequestBuilder<T> createRequest(String endpoint, T resource)
Build a request to create the provided new SCIM resource at the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.resource
- The new resource to create.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
retrieveRequest
public RetrieveRequestBuilder.Typed retrieveRequest(String endpoint, String id)
Build a request to retrieve a known SCIM resource from the service provider.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
retrieveRequest
public RetrieveRequestBuilder.Typed retrieveRequest(URI url)
Build a request to retrieve a known SCIM resource from the service provider.- Parameters:
url
- The URL of the resource to retrieve.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
retrieveRequest
public <T extends ScimResource> RetrieveRequestBuilder.Generic<T> retrieveRequest(T resource)
Build a request to retrieve a known SCIM resource from the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to retrieve.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
searchRequest
public SearchRequestBuilder searchRequest(String endpoint)
Build a request to query and retrieve resources of a single resource type from the service provider.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
replaceRequest
public <T extends ScimResource> ReplaceRequestBuilder<T> replaceRequest(URI uri, T resource)
Build a request to modify a SCIM resource by replacing the resource's attributes at the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
uri
- The URL of the resource to modify.resource
- The resource to replace.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
replaceRequest
public <T extends ScimResource> ReplaceRequestBuilder<T> replaceRequest(T resource)
Build a request to modify a SCIM resource by replacing the resource's attributes at the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The previously retrieved and revised resource.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
modify
public <T extends ScimResource> T modify(String endpoint, String id, PatchRequest patchRequest, Class<T> clazz) throws ScimException
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values. The service provider configuration may be used to discover service provider support for PATCH.- Specified by:
modify
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).patchRequest
- the patch request to use for the update.clazz
- the class of the SCIM resource.- Returns:
- The modified resource.
- Throws:
ScimException
- if an error occurs.
-
modifyRequest
public ModifyRequestBuilder.Typed modifyRequest(String endpoint, String id)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values. The service provider configuration may be used to discover service provider support for PATCH.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
modifyRequest
public ModifyRequestBuilder.Typed modifyRequest(URI url)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values. The service provider configuration may be used to discover service provider support for PATCH.- Parameters:
url
- The URL of the resource to modify.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
modify
public <T extends ScimResource> T modify(T resource, PatchRequest patchRequest) throws ScimException
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values. The service provider configuration may be used to discover service provider support for PATCH.- Specified by:
modify
in interfaceScimInterface
- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to modify.patchRequest
- the patch request to use for the update.- Returns:
- The modified resource.
- Throws:
ScimException
- if an error occurs.
-
modifyRequest
public <T extends ScimResource> ModifyRequestBuilder.Generic<T> modifyRequest(T resource)
Modify a SCIM resource by updating one or more attributes using a sequence of operations to "add
", "remove
", or "replace
" values. The service provider configuration may be used to discover service provider support for PATCH.- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to modify.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
-
deleteRequest
public DeleteRequestBuilder deleteRequest(String endpoint, String id) throws ScimException
Build a request to delete a SCIM resource at the service provider.- Parameters:
endpoint
- The resource endpoint such as: "Users
" or "Groups
" as defined by the associated resource type.id
- The resource identifier (for example the value of the "id
" attribute).- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
- Throws:
ScimException
- if an error occurs.
-
deleteRequest
public DeleteRequestBuilder deleteRequest(URI url) throws ScimException
Build a request to delete a SCIM resource at the service provider.- Parameters:
url
- The URL of the resource to delete.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
- Throws:
ScimException
- if an error occurs.
-
deleteRequest
public <T extends ScimResource> DeleteRequestBuilder deleteRequest(T resource) throws ScimException
Build a request to delete a SCIM resource at the service provider.- Type Parameters:
T
- The Java type of the resource.- Parameters:
resource
- The resource to delete.- Returns:
- The request builder that may be used to specify additional request parameters and to invoke the request.
- Throws:
ScimException
- if an error occurs.
-
search
public <T extends ScimResource> ListResponse<T> search(String endpoint, String filter, Class<T> clazz) throws ScimException
Search for SCIM resources matching the SCIM filter provided.- Specified by:
search
in interfaceScimInterface
- Type Parameters:
T
- The SCIM resource type to return a list of.- Parameters:
endpoint
- a SCIM resource type endpoint.filter
- a SCIM filter string.clazz
- the class representing the type of the SCIM resource.- Returns:
- a List of ScimResource objects matching the provided filter.
- Throws:
ScimException
- if an error occurs.
-
-