Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: #18 refactor: remove unnecessary annotations pt. 2
  • Loading branch information
jgomer2001 committed Jul 28, 2021
1 parent 8c79cc1 commit 5cea1ee
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 71 deletions.
Expand Up @@ -34,8 +34,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.wordnik.swagger.annotations.ApiOperation;

import org.apache.commons.lang.StringUtils;

import org.gluu.oxtrust.model.exception.SCIMException;
Expand All @@ -58,8 +56,6 @@
* Implementation of /Fido2Devices endpoint. Methods here are intercepted and/or decorated.
* Class org.gluu.oxtrust.service.scim2.interceptor.Fido2DeviceWebServiceDecorator is used to apply pre-validations on data.
* Filter org.gluu.oxtrust.ws.rs.scim2.AuthorizationProcessingFilter secures invocations
*
* @author jgomer
*/
@Named("scim2Fido2DeviceEndpoint")
@Path("/scim/v2/Fido2Devices")
Expand All @@ -79,7 +75,6 @@ public class Fido2DeviceWebService extends BaseScimWebService implements IFido2D
@Produces({MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT})
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Create device", response = Fido2DeviceResource.class)
public Response createDevice() {
log.debug("Executing web service method. createDevice");
return getErrorResponse(Response.Status.NOT_IMPLEMENTED, "Not implemented; device registration only happens via the FIDO 2.0 API.");
Expand All @@ -91,7 +86,6 @@ public Response createDevice() {
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Find device by id", notes = "Returns a device by id as path param", response = Fido2DeviceResource.class)
public Response getF2DeviceById(@PathParam("id") String id,
@QueryParam("userId") String userId,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList,
Expand Down Expand Up @@ -129,7 +123,6 @@ public Response getF2DeviceById(@PathParam("id") String id,
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Update device", response = Fido2DeviceResource.class)
public Response updateF2Device(
Fido2DeviceResource fidoDeviceResource,
@PathParam("id") String id,
Expand Down Expand Up @@ -180,7 +173,6 @@ public Response updateF2Device(
@Produces({MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT})
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Delete device")
public Response deleteF2Device(@PathParam("id") String id) {

Response response;
Expand Down Expand Up @@ -209,7 +201,6 @@ public Response deleteF2Device(@PathParam("id") String id) {
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search devices", notes = "Returns a list of devices", response = ListResponse.class)
public Response searchF2Devices(
@QueryParam("userId") String userId,
@QueryParam(QUERY_PARAM_FILTER) String filter,
Expand Down Expand Up @@ -248,7 +239,6 @@ public Response searchF2Devices(
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search devices POST /.search", notes = "Returns a list of fido devices", response = ListResponse.class)
public Response searchF2DevicesPost(SearchRequest searchRequest, @QueryParam("userId") String userId) {

log.debug("Executing web service method. searchDevicesPost");
Expand Down Expand Up @@ -347,7 +337,6 @@ private PagedResult<BaseScimResource> searchDevices(String userId, String filter
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "PATCH operation", notes = "https://tools.ietf.org/html/rfc7644#section-3.5.2", response = Fido2DeviceResource.class)
public Response patchF2Device(
PatchRequest request,
@PathParam("id") String id,
Expand Down
Expand Up @@ -32,15 +32,12 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.wordnik.swagger.annotations.ApiOperation;

import org.apache.commons.lang.StringUtils;

import org.gluu.oxtrust.model.exception.SCIMException;
import org.gluu.oxtrust.model.fido.GluuCustomFidoDevice;
import org.gluu.oxtrust.model.scim2.BaseScimResource;
import org.gluu.oxtrust.model.scim2.ErrorScimType;
import org.gluu.oxtrust.model.scim2.ListResponse;
import org.gluu.oxtrust.model.scim2.Meta;
import org.gluu.oxtrust.model.scim2.SearchRequest;
import org.gluu.oxtrust.model.scim2.fido.FidoDeviceResource;
Expand All @@ -56,15 +53,10 @@
import org.gluu.persist.model.SortOrder;
import org.gluu.search.filter.Filter;

import com.wordnik.swagger.annotations.ApiOperation;

/**
* Implementation of /FidoDevices endpoint. Methods here are intercepted and/or decorated.
* Class org.gluu.oxtrust.service.scim2.interceptor.FidoDeviceWebServiceDecorator is used to apply pre-validations on data.
* Filter org.gluu.oxtrust.ws.rs.scim2.AuthorizationProcessingFilter secures invocations
*
* @author Val Pecaoco
* Updated by jgomer on 2017-10-09.
*/
@Named("scim2FidoDeviceEndpoint")
@Path("/scim/v2/FidoDevices")
Expand All @@ -86,7 +78,6 @@ public class FidoDeviceWebService extends BaseScimWebService implements IFidoDev
@Produces({MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT})
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Create device", response = FidoDeviceResource.class)
public Response createDevice() {
log.debug("Executing web service method. createDevice");
return getErrorResponse(Response.Status.NOT_IMPLEMENTED, "Not implemented; device registration only happens via the FIDO API.");
Expand All @@ -98,7 +89,6 @@ public Response createDevice() {
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Find device by id", notes = "Returns a device by id as path param", response = FidoDeviceResource.class)
public Response getDeviceById(@PathParam("id") String id,
@QueryParam("userId") String userId,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList,
Expand Down Expand Up @@ -136,7 +126,6 @@ public Response getDeviceById(@PathParam("id") String id,
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Update device", response = FidoDeviceResource.class)
public Response updateDevice(
FidoDeviceResource fidoDeviceResource,
@PathParam("id") String id,
Expand Down Expand Up @@ -186,7 +175,6 @@ public Response updateDevice(
@Produces({MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT})
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Delete device")
public Response deleteDevice(@PathParam("id") String id) {

Response response;
Expand Down Expand Up @@ -215,7 +203,6 @@ public Response deleteDevice(@PathParam("id") String id) {
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search devices", notes = "Returns a list of devices", response = ListResponse.class)
public Response searchDevices(
@QueryParam("userId") String userId,
@QueryParam(QUERY_PARAM_FILTER) String filter,
Expand Down Expand Up @@ -254,7 +241,6 @@ public Response searchDevices(
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search devices POST /.search", notes = "Returns a list of fido devices", response = ListResponse.class)
public Response searchDevicesPost(SearchRequest searchRequest, @QueryParam("userId") String userId) {

log.debug("Executing web service method. searchDevicesPost");
Expand Down Expand Up @@ -390,7 +376,6 @@ private PagedResult<BaseScimResource> searchDevices(String userId, String filter
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "PATCH operation", notes = "https://tools.ietf.org/html/rfc7644#section-3.5.2", response = FidoDeviceResource.class)
public Response patchDevice(
PatchRequest request,
@PathParam("id") String id,
Expand Down
Expand Up @@ -35,7 +35,6 @@
import org.gluu.oxtrust.model.exception.SCIMException;
import org.gluu.oxtrust.model.scim2.BaseScimResource;
import org.gluu.oxtrust.model.scim2.ErrorScimType;
import org.gluu.oxtrust.model.scim2.ListResponse;
import org.gluu.oxtrust.model.scim2.SearchRequest;
import org.gluu.oxtrust.model.scim2.group.GroupResource;
import org.gluu.oxtrust.model.scim2.patch.PatchOperation;
Expand All @@ -49,23 +48,13 @@
import org.gluu.persist.model.PagedResult;
import org.gluu.persist.model.SortOrder;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.Authorization;

/**
* Implementation of /Groups endpoint. Methods here are intercepted and/or decorated.
* Class org.gluu.oxtrust.service.scim2.interceptor.GroupWebServiceDecorator is used to apply pre-validations on data.
* Filter org.gluu.oxtrust.filter.AuthorizationProcessingFilter secures invocations
*
* @author Rahat Ali Date: 05.08.2015
* Updated by jgomer on 2017-10-18
*/
@Named("scim2GroupEndpoint")
@Path("/scim/v2/Groups")
@Api(value = "/v2/Groups", description = "SCIM 2.0 Group Endpoint (https://tools.ietf.org/html/rfc7644#section-3.2)",
authorizations = {@Authorization(value = "Authorization", type = "uma")})
public class GroupWebService extends BaseScimWebService implements IGroupWebService {

@Inject
Expand All @@ -86,9 +75,8 @@ public class GroupWebService extends BaseScimWebService implements IGroupWebServ
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Create group", notes = "Create group (https://tools.ietf.org/html/rfc7644#section-3.3)", response = GroupResource.class)
public Response createGroup(
@ApiParam(value = "Group", required = true) GroupResource group,
GroupResource group,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList) {

Expand All @@ -113,8 +101,6 @@ public Response createGroup(
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Find group by id", notes = "Returns a group by id as path param (https://tools.ietf.org/html/rfc7644#section-3.4.2.1)",
response = GroupResource.class)
public Response getGroupById(
@PathParam("id") String id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList,
Expand Down Expand Up @@ -155,9 +141,8 @@ public Response getGroupById(
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Update group", notes = "Update group (https://tools.ietf.org/html/rfc7644#section-3.5.1)", response = GroupResource.class)
public Response updateGroup(
@ApiParam(value = "Group", required = true) GroupResource group,
GroupResource group,
@PathParam("id") String id,
@QueryParam(QUERY_PARAM_ATTRIBUTES) String attrsList,
@QueryParam(QUERY_PARAM_EXCLUDED_ATTRS) String excludedAttrsList) {
Expand Down Expand Up @@ -186,7 +171,6 @@ public Response updateGroup(
@Produces({MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT})
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Delete group", notes = "Delete group (https://tools.ietf.org/html/rfc7644#section-3.6)")
public Response deleteGroup(@PathParam("id") String id){

Response response;
Expand All @@ -209,7 +193,6 @@ public Response deleteGroup(@PathParam("id") String id){
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search groups", notes = "Returns a list of groups (https://tools.ietf.org/html/rfc7644#section-3.4.2.2)", response = ListResponse.class)
public Response searchGroups(
@QueryParam(QUERY_PARAM_FILTER) String filter,
@QueryParam(QUERY_PARAM_START_INDEX) Integer startIndex,
Expand Down Expand Up @@ -248,8 +231,7 @@ public Response searchGroups(
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "Search group POST /.search", notes = "Returns a list of groups (https://tools.ietf.org/html/rfc7644#section-3.4.3)", response = ListResponse.class)
public Response searchGroupsPost(@ApiParam(value = "SearchRequest", required = true) SearchRequest searchRequest){
public Response searchGroupsPost(SearchRequest searchRequest){

log.debug("Executing web service method. searchGroupsPost");

Expand All @@ -275,7 +257,6 @@ public Response searchGroupsPost(@ApiParam(value = "SearchRequest", required = t
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "PATCH operation", notes = "https://tools.ietf.org/html/rfc7644#section-3.5.2", response = GroupResource.class)
public Response patchGroup(
PatchRequest request,
@PathParam("id") String id,
Expand Down
Expand Up @@ -32,15 +32,8 @@
import org.gluu.oxtrust.service.scim2.ExtensionService;
import org.gluu.oxtrust.service.scim2.interceptor.RejectFilterParam;

import com.wordnik.swagger.annotations.Api;

/**
* @author Rahat Ali Date: 05.08.2015
* Re-engineered by jgomer on 2017-09-25.
*/
@Named("resourceTypesWs")
@Path("/scim/v2/ResourceTypes")
@Api(value = "/v2/ResourceTypes", description = "SCIM 2.0 ResourceType Endpoint (https://tools.ietf.org/html/rfc7643#section-6)")
public class ResourceTypeWS extends BaseScimWebService {

//The following are not computed using the endpointUrl's of web services since they are required to be constant (used in @Path annotations)
Expand Down
Expand Up @@ -39,17 +39,12 @@
import org.gluu.oxtrust.service.scim2.interceptor.RejectFilterParam;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.wordnik.swagger.annotations.Api;

/**
* Web service for the /Schemas endpoint.
*
* @author Val Pecaoco
* Re-engineered by jgomer on 2017-09-27.
*/
@Named("scim2SchemaEndpoint")
@Path("/scim/v2/Schemas")
@Api(value = "/v2/Schemas", description = "SCIM 2.0 Schema Endpoint (https://tools.ietf.org/html/rfc7643#section-4)")
public class SchemaWebService extends BaseScimWebService {

private Map<String, Class<? extends BaseScimResource>> resourceSchemas;
Expand Down
Expand Up @@ -37,13 +37,8 @@
import org.gluu.oxtrust.service.scim2.serialization.ListResponseJsonSerializer;
import org.gluu.util.Pair;

import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

/**
* Implementation of the /.search endpoint for the root URL of the service
*
* Created by jgomer on 2017-10-25.
*/
@Named
@Path("/scim/v2/.search")
Expand Down Expand Up @@ -73,8 +68,7 @@ public class SearchResourcesWebService extends BaseScimWebService {
@HeaderParam("Accept") @DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@RefAdjusted
@ApiOperation(value = "General search POST /.search", notes = "Returns a list of resources (https://tools.ietf.org/html/rfc7644#section-3.4.3)", response = ListResponse.class)
public Response search(@ApiParam(value = "SearchRequest", required = true) SearchRequest searchRequest) {
public Response search(SearchRequest searchRequest) {

SearchRequest searchReq = new SearchRequest();
Response response = prepareSearchRequest(searchRequest.getSchemas(), searchRequest.getFilter(), null, searchRequest.getSortBy(),
Expand Down
Expand Up @@ -20,10 +20,6 @@
import org.gluu.oxtrust.model.scim2.util.ScimResourceUtil;
import org.gluu.oxtrust.service.scim2.interceptor.RejectFilterParam;

/**
* @author Rahat Ali Date: 05.08.2015
* Updated by jgomer2001 on 2017-09-23
*/
@Named("serviceProviderConfig")
@Path("/scim/v2/ServiceProviderConfig")
public class ServiceProviderConfigWS extends BaseScimWebService {
Expand Down

0 comments on commit 5cea1ee

Please sign in to comment.