diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 07ef52fde5a..0d53ffbc058 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -207,6 +207,24 @@ io.swagger swagger-annotations + + + io.swagger + swagger-core + + + org.slf4j + slf4j-api + + + + + io.swagger + swagger-jaxrs + + + javax.servlet + servlet-api provided diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/ApiOriginFilter.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/ApiOriginFilter.java new file mode 100644 index 00000000000..9ba3b5b97b4 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/ApiOriginFilter.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.wso2.carbon.device.mgt.jaxrs; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiOriginFilter implements Filter { + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() { + //do nothing + } + + public void init(FilterConfig filterConfig) throws ServletException { + //do nothing + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Authentication.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Authentication.java deleted file mode 100644 index e28de808a09..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Authentication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.jaxrs.api; - -import io.swagger.annotations.Api; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; - -/** - * Authentication related REST-API interface. - */ -@Api(value = "Authentication") -@Produces({ "application/json", "application/xml" }) -@Consumes({ "application/json", "application/xml" }) -public interface Authentication { - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Certificate.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Certificate.java index 8bfcd31f660..8a2662036b3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Certificate.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Certificate.java @@ -36,8 +36,9 @@ import javax.ws.rs.core.Response; /** * All the certificate related tasks such as saving certificates, can be done through this endpoint. */ -@Api(value = "Certificate", description = "certificate related tasks such as saving certificates") +@Api(value = "Certificate", description = "Certificate related tasks such as saving certificates") @SuppressWarnings("NonJaxWsWebServices") +@Path("/certificates") @Produces({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" }) public interface Certificate { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Configuration.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Configuration.java index c7bc7759cf2..5e7c8a9cd27 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Configuration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Configuration.java @@ -35,6 +35,7 @@ import javax.ws.rs.core.Response; * All end points support JSON, XMl with content negotiation. */ @Api(value = "Configuration", description = "General Tenant Configuration implementation") +@Path("/configuration") @SuppressWarnings("NonJaxWsWebServices") @Produces({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" }) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Device.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Device.java index 9710e6f426c..97b34d16fee 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Device.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Device.java @@ -29,7 +29,8 @@ import javax.ws.rs.core.Response; /** * Device related operations such as get all the available devices, etc. */ -@Api(value = "Devices") +@Api(value = "Devices", description = "") +@Path("/devices") @SuppressWarnings("NonJaxWsWebServices") public interface Device { @@ -40,6 +41,7 @@ public interface Device { * @return Device List */ @GET + @Path("devices") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, @@ -94,7 +96,7 @@ public interface Device { */ @GET @Path("user/{user}") - Response getDevice(@PathParam("user") String user); + Response getDeviceOfUser(@PathParam("user") String user); /** * Fetch device count of a given user. @@ -104,7 +106,7 @@ public interface Device { */ @GET @Path("user/{user}/count") - Response getDeviceCount(@PathParam("user") String user); + Response getDeviceCountOfUser(@PathParam("user") String user); /** * Get current device count diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceInformation.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceInformation.java index d55477eb076..f03c5c6c731 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceInformation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceInformation.java @@ -37,6 +37,7 @@ import javax.ws.rs.core.Response; * Device information related operations. */ @Api(value = "DeviceInfo") +@Path("/information") @SuppressWarnings("NonJaxWsWebServices") public interface DeviceInformation { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceNotification.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceNotification.java index f17e5840518..9e1aa4ddfc4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceNotification.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceNotification.java @@ -42,6 +42,7 @@ import javax.ws.rs.core.Response; */ @Api(value = "DeviceNotification") @SuppressWarnings("NonJaxWsWebServices") +@Path("/notifications") @Produces({"application/json", "application/xml"}) @Consumes({ "application/json", "application/xml" }) public interface DeviceNotification { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceSearch.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceSearch.java index ec27086e360..9cf154e9554 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceSearch.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/DeviceSearch.java @@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.common.device.details.DeviceWrapper; import org.wso2.carbon.device.mgt.common.search.SearchContext; import javax.ws.rs.GET; +import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -35,6 +36,7 @@ import javax.ws.rs.core.Response; * Device search related operations such as getting device information. */ @Api(value = "DeviceSearch") +@Path("/search") @SuppressWarnings("NonJaxWsWebServices") public interface DeviceSearch { @@ -50,6 +52,6 @@ public interface DeviceSearch { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 500, message = "Error occurred while searching the device information") }) - Response getDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions", + Response getFilteredDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions", required = true) SearchContext searchContext); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Feature.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Feature.java index 42f23ae3b9c..c95195714be 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Feature.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Feature.java @@ -33,6 +33,7 @@ import javax.ws.rs.core.Response; */ @Api(value = "Feature") @SuppressWarnings("NonJaxWsWebServices") +@Path("/features") @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) public interface Feature { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/License.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/License.java index fe07dce2e32..f8884e818c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/License.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/License.java @@ -28,6 +28,7 @@ import javax.ws.rs.core.Response; * This class represents license related operations. */ @Api(value = "License") +@Path("/license") @SuppressWarnings("NonJaxWsWebServices") public interface License { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Operation.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Operation.java index 131eef9b2da..8c3bc55a974 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Operation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Operation.java @@ -37,6 +37,7 @@ import javax.ws.rs.core.Response; * */ @Api(value = "Operation") +@Path("/operations") public interface Operation { /* @deprecated */ @@ -49,7 +50,7 @@ public interface Operation { consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, httpMethod = "GET", - value = "Getting Pagination Details for Operations on a Device.", + value = "Getting Paginated Details for Operations on a Device.", notes = "You will carry out many operations on a device. In a situation where you wish to view the all" + " the operations carried out on a device it is not feasible to show all the details on one page" + " therefore the details are paginated." + @@ -89,7 +90,7 @@ public interface Operation { @ApiResponses(value = { @ApiResponse(code = 200, message = "List of Operations on a device."), @ApiResponse(code = 500, message = "Error occurred while fetching the operations for the " + "device.") }) - Response getDeviceOperations(@ApiParam(name = "type", value = "Define the device type as the value for {type}. " + + Response getAllDeviceOperations(@ApiParam(name = "type", value = "Define the device type as the value for {type}. " + "Example: ios, android or windows.", required = true) @PathParam("type") String type, @ApiParam(name = "id", value = "Define the device ID", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Policy.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Policy.java index e266e8ee944..9cad9178428 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Policy.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Policy.java @@ -39,6 +39,7 @@ import java.util.List; * */ @Api(value = "Policy") +@Path("/policies") public interface Policy { @POST diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Profile.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Profile.java index 182b1adbf63..7762048499c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Profile.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Profile.java @@ -30,6 +30,7 @@ import javax.ws.rs.core.Response; * These end points provide profile related operations. */ @Api(value = "Profile") +@Path("/profiles") @SuppressWarnings("NonJaxWsWebServices") public interface Profile { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Role.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Role.java index abf48eb8e5f..57ec14ce761 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Role.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/Role.java @@ -19,27 +19,16 @@ package org.wso2.carbon.device.mgt.jaxrs.api; import io.swagger.annotations.*; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleWrapper; import org.wso2.carbon.user.mgt.common.UIPermissionNode; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; -/** - * - */ @Api(value = "Role") +@Path("/roles") public interface Role { @GET @@ -54,7 +43,7 @@ public interface Role { response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "List of available roles"), @ApiResponse(code = 500, message = "Error occurred while fetching the role list.") }) - Response getRoles(); + Response getAllRoles(); @GET @Path("{userStore}") @@ -69,7 +58,7 @@ public interface Role { response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "List of available roles"), @ApiResponse(code = 500, message = "Error occurred while fetching the role list.") }) - Response getRoles(@ApiParam(name = "userStore", value = "Provide the name of the UserStore you wish to get the" + + Response getRolesOfUserStore(@ApiParam(name = "userStore", value = "Provide the name of the UserStore you wish to get the" + " details from ", required = true) @PathParam("userStore") String userStore); @@ -208,4 +197,5 @@ public interface Role { @ApiResponses(value = { @ApiResponse(code = 200, message = "Retrieved the role count."), @ApiResponse(code = 500, message = "Error occurred while retrieving the role count.") }) Response getRoleCount(); + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/User.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/User.java index 6c5e45b7b92..747abf0b4ac 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/User.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/User.java @@ -45,6 +45,7 @@ import java.util.List; * This represents the JAX-RS services of User related functionality. */ @Api(value = "User") +@Path("/users") public interface User { @POST @@ -139,7 +140,7 @@ public interface User { @ApiResponse(code = 400, message = "User by username: 'username' does not exist for role retrieval"), @ApiResponse(code = 500, message = "Exception in trying to retrieve roles for user by username: 'username'") }) - Response getRoles(@ApiParam(name = "username", value = "Provide the user name of the user you wish to get" + Response getRolesOfUser(@ApiParam(name = "username", value = "Provide the user name of the user you wish to get" + " the role details", required = true) @QueryParam("username") String username); @GET @@ -264,7 +265,7 @@ public interface User { @PUT @Path("{roleName}/users") @Produces({MediaType.APPLICATION_JSON}) - Response updateRoles(@PathParam("username") String username, List userList); + Response updateRoles(@PathParam("roleName") String roleName, List userList); @POST @Path("change-password") diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/AuthenticationImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/AuthenticationImpl.java deleted file mode 100644 index 8bc0cd78d87..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/AuthenticationImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.jaxrs.api.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; - -/** - * Authentication related REST-API implementation. - */ -@Produces({ "application/json", "application/xml" }) -@Consumes({ "application/json", "application/xml" }) -public class AuthenticationImpl { - - private static Log log = LogFactory.getLog(AuthenticationImpl.class); -} - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceImpl.java index e25b9b9288f..19ea361c089 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceImpl.java @@ -142,7 +142,7 @@ public class DeviceImpl implements Device{ */ @GET @Path("user/{user}") - public Response getDevice(@PathParam("user") String user) { + public Response getDeviceOfUser(@PathParam("user") String user) { List devices; try { devices = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(user); @@ -165,7 +165,7 @@ public class DeviceImpl implements Device{ */ @GET @Path("user/{user}/count") - public Response getDeviceCount(@PathParam("user") String user) { + public Response getDeviceCountOfUser(@PathParam("user") String user) { try { Integer count = DeviceMgtAPIUtils.getDeviceManagementService().getDeviceCount(user); return Response.status(Response.Status.OK).entity(count).build(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceSearchImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceSearchImpl.java index 4582fa24d3d..7ed9576d0b5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceSearchImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/DeviceSearchImpl.java @@ -38,7 +38,7 @@ public class DeviceSearchImpl implements DeviceSearch { private static Log log = LogFactory.getLog(DeviceSearchImpl.class); @GET - public Response getDeviceInfo(SearchContext searchContext) { + public Response getFilteredDeviceInfo(SearchContext searchContext) { SearchManagerService searchManagerService; List devices; try { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/OperationImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/OperationImpl.java index bdca4c54915..09beeeeda44 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/OperationImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/OperationImpl.java @@ -103,7 +103,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera @Override @GET @Path("{type}/{id}") - public Response getDeviceOperations(@PathParam("type") String type, @PathParam("id") String id) { + public Response getAllDeviceOperations(@PathParam("type") String type, @PathParam("id") String id) { List operations; DeviceManagementProviderService dmService; DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/RoleImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/RoleImpl.java index 739f5f56782..278a7dfd269 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/RoleImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/RoleImpl.java @@ -65,7 +65,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role { @Override @GET @Produces({MediaType.APPLICATION_JSON}) - public Response getRoles() { + public Response getAllRoles() { List filteredRoles; try { filteredRoles = getRolesFromUserStore(); @@ -89,7 +89,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role { @GET @Path("{userStore}") @Produces({MediaType.APPLICATION_JSON}) - public Response getRoles(@PathParam("userStore") String userStore) { + public Response getRolesOfUserStore(@PathParam("userStore") String userStore) { String[] roles; try { AbstractUserStoreManager abstractUserStoreManager = diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/UserImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/UserImpl.java index 2b136e6131f..427a654e544 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/UserImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/UserImpl.java @@ -371,7 +371,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User { @GET @Path("roles") @Produces({MediaType.APPLICATION_JSON}) - public Response getRoles(@QueryParam("username") String username) { + public Response getRolesOfUser(@QueryParam("username") String username) { ResponsePayload responsePayload = new ResponsePayload(); try { UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); @@ -716,7 +716,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User { @PUT @Path("{roleName}/users") @Produces({MediaType.APPLICATION_JSON}) - public Response updateRoles(@PathParam("username") String username, List userList) { + public Response updateRoles(@PathParam("roleName") String username, List userList) { try { final UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); if (log.isDebugEnabled()) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 3f2159018c1..05d9a6d8b41 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -24,145 +24,46 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + @@ -175,9 +76,6 @@ - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml index ab8d04cbe83..97f0970968d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -25,6 +25,16 @@ org.apache.cxf.transport.servlet.CXFServlet + + + + + + + + swagger.security.filter + ApiAuthorizationFilterImpl + 1 @@ -41,7 +51,7 @@ doAuthentication - true + false