Interface IUserWebService
-
public interface IUserWebService
SCIM service interface with available methods to manipulate User resources.The parameters attrsList and excludedAttrsList found in methods of this interface are aimed at specifying the "attributes" and "excludedAttributes" query params regarded in section 3.9 of SCIM spec protocol document (RFC 7644).
Every SCIM service operation that returns resources (e.g Users, Groups, etc.) offers the possibility to specify which attributes can be included for every resource part of the response. The default behavior is returning those attributes that according to the resource Schema have returnability = "always" in addition to those with returnability = "default".
attrsList is used to override the default attribute set, so when supplying a not-null or not empty String, the attributes included in the resource(s) of the response will be those with returnability = "always" as well as those specified by attrsList.
This parameter consists of a comma-separated list of attribute names. An example of a valid value for attrsList when the resource of interest is User, could be:
userName, active, name.familyName, addresses, emails.value, emails.type, urn:ietf:params:scim:schemas:extension:gluu:2.0:User:myCustomAttribute
Note that attributes marked with returnability = "never" (such as a User password) will always be filtered out from the output, so including such attributes in attrsList has no effect.
excludedAttrsList is used to specify the set of attributes that should be excluded from the default attribute set. In this sense, the resources found in the response will include the attributes whose returnability = "always" in addition to those with returnability = "default" except for those included in excludedAttrsList. As with attrsList, this parameter must be in the form of a comma-separated list of attribute names.
attrsList and excludedAttrsList are mutually exclusive: if both are provided only attrsList will be taken into account to compute the output attribute set.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.ws.rs.core.Response
createUser(UserResource user, String attrsList, String excludedAttrsList)
Service method that allows creating a User resource via POST (as per section 3.3 of RFC 7644).javax.ws.rs.core.Response
deleteUser(String id)
Removes a User via DELETE HTTP method (see section 3.6 of RFC 7644).javax.ws.rs.core.Response
getUserById(String id, String attrsList, String excludedAttrsList)
Service method that retrieves a User resource using GET (as per section 3.4.1 of RFC 7644).javax.ws.rs.core.Response
patchUser(PatchRequest request, String id, String attrsList, String excludedAttrsList)
Service method that allows to modify a User resource via PATCH (see section 3.5.2 of RFC 7644).javax.ws.rs.core.Response
searchUsers(String filter, Integer startIndex, Integer count, String sortBy, String sortOrder, String attrsList, String excludedAttrsList)
Sends a search query for User resources using GET (see section 3.4.2 of RFC 7644).javax.ws.rs.core.Response
searchUsersPost(SearchRequest searchRequest)
Sends a search query for User resources using POST (see section 3.4.3 of RFC 7644).javax.ws.rs.core.Response
updateUser(UserResource user, String id, String attrsList, String excludedAttrsList)
Service method that allows updating a User resource via PUT (as per section 3.5.1 of RFC 7644).
-
-
-
Method Detail
-
createUser
@Path("/v2/Users") @POST @Consumes({"application/scim+json","application/json"}) @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response createUser(UserResource user, @QueryParam("attributes") String attrsList, @QueryParam("excludedAttributes") String excludedAttrsList)
Service method that allows creating a User resource via POST (as per section 3.3 of RFC 7644).- Parameters:
user
- An object that represents the User to createattrsList
- See notes about attributes query param in this interface descriptionexcludedAttrsList
- See notes about excludedAttributes query param in this interface description- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this operation should contain a status code of 201 (created) and a
UserResource
in the entity body (the resource just created)
-
getUserById
@Path("/v2/Users/{id}") @GET @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response getUserById(@PathParam("id") String id, @QueryParam("attributes") String attrsList, @QueryParam("excludedAttributes") String excludedAttrsList)
Service method that retrieves a User resource using GET (as per section 3.4.1 of RFC 7644).- Parameters:
id
- The "id" attribute of the resource to retrieveattrsList
- See notes about attributes query param in this interface descriptionexcludedAttrsList
- See notes about excludedAttributes query param in this interface description- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this operation should contain a status code of 200 and a
UserResource
in the entity body (the resource retrieved)
-
updateUser
@Path("/v2/Users/{id}") @PUT @Consumes({"application/scim+json","application/json"}) @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response updateUser(UserResource user, @PathParam("id") String id, @QueryParam("attributes") String attrsList, @QueryParam("excludedAttributes") String excludedAttrsList)
Service method that allows updating a User resource via PUT (as per section 3.5.1 of RFC 7644).This operation is not suitable to delete/remove/nullify attributes. For this purpose you can use the PATCH operation instead. PUT is intended to do replacements using the (not-null) values supplied in
user
parameter.To learn more about how the update works, read the replacement rules found at
ScimResourceUtil#transferToResourceReplace
.- Parameters:
user
- An object that contains the data to update on a destination resource. There is no need to supply a full resource, just provide one with the attributes which are intended to be replaced in the destinationid
- The "id" attribute of the resource to update (destination)attrsList
- See notes about attributes query param in this interface descriptionexcludedAttrsList
- See notes about excludedAttributes query param in this interface description- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this operation should contain a status code of 200 and a
UserResource
in the entity body (the resource after the update took place)
-
deleteUser
@Path("/v2/Users/{id}") @DELETE @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response deleteUser(@PathParam("id") String id)
Removes a User via DELETE HTTP method (see section 3.6 of RFC 7644).- Parameters:
id
- The "id" attribute of the resource to be removed- Returns:
- An object abstracting the response obtained from the server to this request. A succesful response for this operation should contain a status code of 204 (no content)
-
searchUsers
@Path("/v2/Users") @GET @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response searchUsers(@QueryParam("filter") String filter, @QueryParam("startIndex") Integer startIndex, @QueryParam("count") Integer count, @QueryParam("sortBy") String sortBy, @QueryParam("sortOrder") String sortOrder, @QueryParam("attributes") String attrsList, @QueryParam("excludedAttributes") String excludedAttrsList)
Sends a search query for User resources using GET (see section 3.4.2 of RFC 7644).- Parameters:
filter
- A filter expression so that the search will return only those resources matching the expression. To learn more about SCIM filter expressions and operators, see section 3.4.2.2 of RFC 7644.startIndex
- The 1-based index of the first query result. If a negative integer or null is provided, the search is performed as if 1 was provided as value.count
- Specifies the desired maximum number of query results per page the response must include. If null is provided, the maximum supported by the server is used. If count is zero, this is interpreted as no results should be included (only the total amount is). If a negative number is supplied, the search is performed as if zero was provided as value.sortBy
- Specifies the attribute whose value will be used to order the returned resources. If sortBy is null the results will be sorted by userName attribute.sortOrder
- The order in which thesortBy
parameter is applied. Allowed values are "ascending" or "descending", being "ascending" the default if null or an unknown value is passed.attrsList
- See notes about attributes query param in this interface descriptionexcludedAttrsList
- See notes about excludedAttributes query param in this interface description- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this operation should contain a status code of 200 and a
ListResponse
in the entity body (holding a collection of SCIM resources)
-
searchUsersPost
@Path("/v2/Users/.search") @POST @Consumes({"application/scim+json","application/json"}) @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response searchUsersPost(SearchRequest searchRequest)
Sends a search query for User resources using POST (see section 3.4.3 of RFC 7644).- Parameters:
searchRequest
- An object containing the parameters for the query to execute. These are the same parameters passed in the URL for searches, for example insearchDevices
- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this request should contain a status code of 200 and a
ListResponse
in the entity body (holding a collection of SCIM resources)
-
patchUser
@Path("/v2/Users/{id}") @Consumes({"application/scim+json","application/json"}) @Produces({"application/scim+json; charset=utf-8","application/json; charset=utf-8"}) @HeaderParam("Accept") @DefaultValue("application/scim+json") javax.ws.rs.core.Response patchUser(PatchRequest request, @PathParam("id") String id, @QueryParam("attributes") String attrsList, @QueryParam("excludedAttributes") String excludedAttrsList)
Service method that allows to modify a User resource via PATCH (see section 3.5.2 of RFC 7644).Note that patching offers a fine-grained control over the attributes to modify. While PUT is more intended to replace attribute values, PATCH allows to perform localized updates, removals and additions in certain portions of the target resource.
- Parameters:
request
- APatchRequest
that contains the operations to apply upon the resource being updatedid
- The id of the resource to updateattrsList
- See notes about attributes query param in this interface descriptionexcludedAttrsList
- See notes about excludedAttributes query param in this interface description- Returns:
- An object abstracting the response obtained from the server to this request.
A succesful response for this operation should contain a status code of 200 and a
UserResource
in the entity body (the resource after modifications took place)
-
-