use of org.gluu.oxtrust.model.scim2.SearchRequest in project oxTrust by GluuFederation.
the class FidoDeviceWebServiceDecorator method searchDevices.
public Response searchDevices(String userId, String filter, Integer startIndex, Integer count, String sortBy, String sortOrder, String attrsList, String excludedAttrsList) {
SearchRequest searchReq = new SearchRequest();
Response response = prepareSearchRequest(searchReq.getSchemas(), filter, sortBy, sortOrder, startIndex, count, attrsList, excludedAttrsList, searchReq);
if (response == null) {
response = validateExistenceOfUser(userId);
if (response == null) {
response = service.searchDevices(userId, searchReq.getFilter(), searchReq.getStartIndex(), searchReq.getCount(), searchReq.getSortBy(), searchReq.getSortOrder(), searchReq.getAttributesStr(), searchReq.getExcludedAttributesStr());
}
}
return response;
}
use of org.gluu.oxtrust.model.scim2.SearchRequest in project oxTrust by GluuFederation.
the class GroupWebServiceDecorator method searchGroups.
public Response searchGroups(String filter, Integer startIndex, Integer count, String sortBy, String sortOrder, String attrsList, String excludedAttrsList) {
SearchRequest searchReq = new SearchRequest();
Response response = prepareSearchRequest(searchReq.getSchemas(), filter, sortBy, sortOrder, startIndex, count, attrsList, excludedAttrsList, searchReq);
if (response == null) {
response = service.searchGroups(searchReq.getFilter(), searchReq.getStartIndex(), searchReq.getCount(), searchReq.getSortBy(), searchReq.getSortOrder(), searchReq.getAttributesStr(), searchReq.getExcludedAttributesStr());
}
return response;
}
use of org.gluu.oxtrust.model.scim2.SearchRequest in project oxTrust by GluuFederation.
the class ReferenceURIInterceptor method manage.
@AroundInvoke
public Object manage(InvocationContext ctx) throws Exception {
Object[] params = ctx.getParameters();
Annotation[][] annotations = ctx.getMethod().getParameterAnnotations();
for (int i = 0; i < annotations.length; i++) {
// Iterate over annotations found at every parameter
for (Annotation annotation : annotations[i]) {
if (annotation instanceof QueryParam) {
String paramName = ((QueryParam) annotation).value();
if ((paramName.equals(QUERY_PARAM_FILTER) || paramName.equals(QUERY_PARAM_ATTRIBUTES) || paramName.equals(QUERY_PARAM_EXCLUDED_ATTRS))) {
log.trace("Removing '$' char (if any) from {} param", paramName);
params[i] = dropDollar(params[i]);
}
}
}
if (params[i] != null && params[i] instanceof SearchRequest) {
log.trace("Removing '$' char (if any) from SearchRequest object");
SearchRequest sr = (SearchRequest) params[i];
sr.setAttributes(dropDollar(sr.getAttributesStr()));
sr.setExcludedAttributes(dropDollar(sr.getExcludedAttributesStr()));
sr.setFilter(dropDollar(sr.getFilter()));
}
}
log.debug("ReferenceURIInterceptor. manage exit");
return ctx.proceed();
}
use of org.gluu.oxtrust.model.scim2.SearchRequest in project oxTrust by GluuFederation.
the class FidoDeviceWebService method searchDevicesPost.
@Path("/.search")
@POST
@Produces({ Constants.MEDIA_TYPE_SCIM_JSON + "; charset=utf-8", MediaType.APPLICATION_JSON + "; charset=utf-8" })
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
@ApiOperation(value = "Search devices POST /.search", notes = "Returns a list of devices (https://tools.ietf.org/html/rfc7644#section-3.4.3)", response = ListResponse.class)
public Response searchDevicesPost(@HeaderParam("Authorization") String authorization, @QueryParam(OxTrustConstants.QUERY_PARAMETER_TEST_MODE_OAUTH2_TOKEN) final String token, @QueryParam("userId") final String userId, @ApiParam(value = "SearchRequest", required = true) SearchRequest searchRequest) throws Exception {
try {
log.info("IN FidoDeviceWebService.searchDevicesPost()...");
// Authorization check is done in searchDevices()
Response response = searchDevices(authorization, token, userId, searchRequest.getFilter(), searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getSortBy(), searchRequest.getSortOrder(), searchRequest.getAttributesArray());
URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/FidoDevices/.search");
log.info("LEAVING FidoDeviceWebService.searchDevicesPost()...");
return Response.fromResponse(response).location(location).build();
} catch (EntryPersistenceException epe) {
log.error("Error in searchDevicesPost", epe);
epe.printStackTrace();
return getErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource not found");
} catch (Exception e) {
log.error("Error in searchDevicesPost", e);
e.printStackTrace();
return getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_FILTER, INTERNAL_SERVER_ERROR_MESSAGE);
}
}
use of org.gluu.oxtrust.model.scim2.SearchRequest in project oxTrust by GluuFederation.
the class UserWebService method searchUsersPost.
@Path("/.search")
@POST
@Produces({ Constants.MEDIA_TYPE_SCIM_JSON + "; charset=utf-8", MediaType.APPLICATION_JSON + "; charset=utf-8" })
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
@ApiOperation(value = "Search users POST /.search", notes = "Returns a list of users (https://tools.ietf.org/html/rfc7644#section-3.4.3)", response = ListResponse.class)
public Response searchUsersPost(@HeaderParam("Authorization") String authorization, @QueryParam(OxTrustConstants.QUERY_PARAMETER_TEST_MODE_OAUTH2_TOKEN) final String token, @ApiParam(value = "SearchRequest", required = true) SearchRequest searchRequest) throws Exception {
try {
log.info("IN UserWebService.searchUsersPost()...");
// Authorization check is done in searchUsers()
Response response = searchUsers(authorization, token, searchRequest.getFilter(), searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getSortBy(), searchRequest.getSortOrder(), searchRequest.getAttributesArray());
URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/Users/.search");
log.info("LEAVING UserWebService.searchUsersPost()...");
return Response.fromResponse(response).location(location).build();
} catch (EntryPersistenceException ex) {
log.error("Error in searchUsersPost", ex);
ex.printStackTrace();
return getErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource not found");
} catch (Exception ex) {
log.error("Error in searchUsersPost", ex);
ex.printStackTrace();
return getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_FILTER, INTERNAL_SERVER_ERROR_MESSAGE);
}
}
Aggregations