Merge pull request #464 from hasuniea/release-3.0.x

adding windows annotations
merge-requests/1/head
Harshan Liyanage 8 years ago committed by GitHub
commit f3fa3511c6

@ -351,6 +351,20 @@
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>

@ -189,7 +189,7 @@ public final class PluginConstants {
public static final int MODEL_POSITION = 5;
public static final int MAC_ADDRESS_POSITION = 7;
public static final int RESOLUTION_POSITION = 8;
public static final int DEVICE_NAME_POSITION = 9;
public static final int DEVICE_NAME_POSITION = 10;
public static final String SYNCML_DATA_ONE = "1";
public static final String SYNCML_DATA_ZERO = "0";
public static final String OS_VERSION = "OS_VERSION";

@ -54,7 +54,7 @@ import javax.ws.rs.core.Response;
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Configuration Management"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/services/configuration"),
value = "/api/device-mgt/windows/v1.0/configuration"),
})
}
),
@ -63,13 +63,13 @@ import javax.ws.rs.core.Response;
}
)
@Api(value = "Windows Configuration Management",
description = "This carries all the resources related to Windows configurations management functionalities")
description = "This carries all the resources related to Windows configurations management functionalities")
@WebService
@Path("services/configuration")
@Path("/configuration")
@Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public interface ConfigurationMgtService {
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
@ -80,9 +80,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
description = "View Configurations") }
value = "permission",
scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
description = "View Configurations")}
)
}
)
@ -117,7 +117,12 @@ public interface ConfigurationMgtService {
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.")
})
PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
Response getConfiguration(@ApiParam(
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false) @HeaderParam("If-Modified-Since") String ifModifiedSince);
/**
* Update Tenant Configurations for the specific Device type.
@ -136,9 +141,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/configurations/manage",
description = "Manage Configurations") }
value = "permission",
scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage",
description = "Manage Configurations")}
)
}
)
@ -175,11 +180,11 @@ public interface ConfigurationMgtService {
message = "Internal Server Error. \n " +
"Server error occurred while modifying the Windows platform configurations.")
})
Message updateConfiguration
( @ApiParam(
Response updateConfiguration
(@ApiParam(
name = "configuration",
value = "The properties to update the Windows platform configurations.")
PlatformConfiguration configuration) throws WindowsConfigurationException;
PlatformConfiguration configuration) throws WindowsConfigurationException;
@GET
@Path("license")
@ -194,9 +199,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Enroll Device") }
value = "permission",
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Enroll Device")}
)
}
)
@ -236,7 +241,7 @@ public interface ConfigurationMgtService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
"Example: Mon, 05 Jan 2014 15:10:00 +0200.",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException;

@ -18,13 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import javax.jws.WebService;
@ -41,7 +37,7 @@ import java.util.List;
* Interface for Admin operations persisting. This interface accepts operations added via UI.
*/
@Api(value = "Windows Device Management Administrative Service",
description = "Device management related admin APIs.")
description = "Device management related admin APIs.")
@SwaggerDefinition(
info = @Info(
@ -68,31 +64,313 @@ public interface DeviceManagementAdminService {
@POST
@Path("/lock-devices")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock")
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Adding a Device Lock on Windows devices.",
notes = "Using this API you have the option of Device Windows device.",
response = Activity.class,
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/windows/lock",
description = "Lock Device")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the device lock operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified. \n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while locking the device.")
})
Response lock(@HeaderParam("Accept") String headerParam, @ApiParam(
name = "deviceIDs",
value = "Provide the ID of the AWindows device. Multiple device IDs can be added by " +
"using comma separated values. ",
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/disenroll-devices")
@Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows")
Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Dis-enrol the windows Devices",
notes = "Dis-enroll on Android devices",
response = Activity.class,
tags = "Windows Device Management Administrative Service.",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/disenroll/windows",
description = "Dis-enroll the windows devices ")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the Dis-enroll operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a Dis-enroll operation.")
})
Response disenroll(@HeaderParam("Accept") String headerParam, @ApiParam(
name = "deviceIDs",
value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " +
"using comma separated values. ",
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/wipe-devices")
@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe")
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Factory Resetting an Windows Device",
notes = "Factory rest or erase all the data stored on the Windows devices" +
"to restore them back to the original system.",
response = Activity.class,
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/windows/wipe",
description = "DeviceWipe")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the Data wipe operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified." +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding the Data wipe operation.")})
Response wipe(@HeaderParam("Accept") String headerParam, @ApiParam(
name = "deviceIDs",
value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " +
"using comma separated values. ",
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/ring-devices")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring")
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Ringing Windows Devices",
notes = "Ring Windows devices.",
response = Activity.class,
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/windows/ring",
description = "Ring Device") }
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the device ring operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device ring operation.")
})
Response ring(@HeaderParam("Accept") String headerParam, @ApiParam(
name = "deviceIDs",
value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " +
"using comma separated values. ",
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/lock-reset-devices")
@Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock-reset")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds)
throws WindowsDeviceEnrolmentException;
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Lock reset on Windows devices",
notes = "Lock reset on Windows devices.Its use to reset the device pass code",
response = Activity.class,
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/windows/lock-reset",
description = "Lock reset") }
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the lock-reset operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding adding a lock-reset operation.")
})
//
Response lockReset(@HeaderParam("Accept") String acceptHeader, @ApiParam(
name = "deviceIDs",
value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " +
"using comma separated values. ",
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
}

@ -1,111 +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.mobile.windows.api.services;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;
/**
* Windows Device Management REST-API implementation. All end points supports JSON, XMl with content negotiation.
*/
@Api(value = "Windows Device Management",
description = "This carries all the resources related to Windows device management functionalities")
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Device Management"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/windows/v1.0/devices"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@WebService
@Path("/devices")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public interface DeviceManagementService {
/**
* Get all devices.Returns list of Windows devices registered in MDM.
*
* @return Returns retrieved devices.
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
*/
@GET
List<Device> getAllDevices() throws WindowsConfigurationException;
/**
* Fetch Windows device details of a given device Id.
*
* @param deviceId Device Id
* @return Returns retrieved device.
* @throws WindowsConfigurationException occurred while getting device from DB.
*/
@GET
@Path("{id}")
Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException;
/**
* Update Windows device details of given device id.
*
* @param deviceId Device Id.
* @param device Device details to be updated.
* @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info.
*/
@PUT
@Path("{id}")
Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException;
/**
* Fetch the Licence agreement for specific windows platform.
*
* @return Returns License agreement.
* @throws WindowsConfigurationException occurred while getting licence for specific platform and Language.
*/
@GET
@Path("license")
@Produces("application/json")
License getLicense() throws WindowsConfigurationException;
}

@ -1,46 +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.mobile.windows.api.services;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import javax.jws.WebService;
import javax.ws.rs.*;
/**
* Endpoint for Enforce Effective Policy.
*/
@WebService
@Produces({ "application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public interface PolicyManagementService {
/**
* Get the applicable effective policy for an enrolled windows device.
*
* @param deviceId Device Id
* @return Returns retrieved devices.
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
*/
@GET
@Path("{deviceId}")
Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader,
@PathParam("deviceId") String deviceId) throws WindowsConfigurationException;
}

@ -18,25 +18,104 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* Interface for handling authentication request comes via MDM login page.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Binary security token provider"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/federated"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows BST Management",
description = "This carries all the resources related to Windows Binary security token management.")
@WebService
@Path("/bst")
@Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public interface BSTProvider {
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/authentication")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows")
Response getBST(Credentials credentials) throws WindowsDeviceEnrolmentException;
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Getting Binary security token.",
notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.",
tags = "BST Provider",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Getting Binary security token for Windows enrollment " +
"and policy endpoints.")}
)
}
)
@ApiResponses(
value = {
@ApiResponse(code = 200, message = "Ok. \n Successfully fetching the binary security token.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The URL of the added policy."),
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")
}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while fetching Binary security token.")
})
Response getBST(Credentials credentials)
throws WindowsDeviceEnrolmentException;
}

@ -18,6 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

@ -18,6 +18,8 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery;
import io.swagger.annotations.*;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryRequest;
@ -29,6 +31,8 @@ import javax.jws.WebResult;
import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.BindingType;
import javax.xml.ws.RequestWrapper;
@ -38,23 +42,142 @@ import javax.xml.ws.soap.SOAPBinding;
/**
* Interface for Discovery service related operations.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Discovery service provider"),
@ExtensionProperty(name = "context",
value = "api/device-mgt/windows/v1.0/discovery/post"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows Discovery service",
description = "This carries all the resources related to Windows Discovery service.")
@WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE,
name = "IDiscoveryService")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public interface DiscoveryService {
@POST
@ApiOperation(
httpMethod = "POST",
value = "Discovering the server Enrollment policy and Enrollment service Endpoints.",
notes = "Using this API to discover the Enrollment policy,Enrollment service and " +
"federated login page server endpoints in the server. ",
response = DiscoveryResponse.class,
tags = "Windows Device Enrollment.",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/enroll/windows",
description = "Discover the service endpoints.")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "Ok. \n Accepted and getting server endpoints.",
response = DiscoveryResponse.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified. \n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URLr.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while fetching the server endpoints.")
})
@RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
@WebMethod(operationName = "Discover")
@ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
void discover(
@WebParam(name = "request", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
DiscoveryRequest request,
@ApiParam(
name = "DiscoveryRequest",
value = "Discovery service SOAP request.")
DiscoveryRequest request,
@WebParam(mode = WebParam.Mode.OUT, name = "DiscoverResult",
targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
javax.xml.ws.Holder<DiscoveryResponse> response
javax.xml.ws.Holder<DiscoveryResponse> response
) throws WindowsDeviceEnrolmentException;
@ApiOperation(
httpMethod = "GET",
value = "Device ping the server to check whether it is running or not.",
notes = ".",
tags = "Windows Discovery service.",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Ping the Discovery service")}
)
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Server is already running."),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified " +
"in the location header.",
responseHeaders = {
@ResponseHeader(name = "Content-Location",
description = "Source URL of the document.")
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n " +
"Empty body because the client already has the latest version of " +
"the requested resource."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error. You must provide" +
" the device identifier. Additionally, the device identifier can be combined" +
" with either the device type" +
" OR the from and to date."),
@ApiResponse(
code = 404,
message = "Not Found. \n The specified resource does not exist."),
@ApiResponse(
code = 500,
message = "Error occurred while pinging the server.")
})
@GET
@WebMethod
@WebResult()

@ -18,6 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@ -26,15 +29,21 @@ import java.io.Serializable;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DiscoveryRequest")
@ApiModel(value = "DiscoveryRequest",
description = "Discover request related information.")
@SuppressWarnings("unused")
public class DiscoveryRequest implements Serializable {
@ApiModelProperty(name = "emailId", value = "User email address which is submitted to the workplace app" +
" once sign in .", required = true)
@XmlElement(name = "EmailAddress", required = true)
private String emailId;
@ApiModelProperty(name = "version", value = "OS version on the Windows Device.", required = true)
@XmlElement(name = "RequestVersion")
private String version;
@ApiModelProperty(name = "deviceType", value = "Type of the Device(LapTop/Mobile Device).", required = true)
@XmlElement(name = "DeviceType")
private String deviceType;

@ -29,7 +29,6 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.ConfigurationMgtService;
@ -55,17 +54,17 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
* @throws WindowsConfigurationException
*/
@GET
public PlatformConfiguration getConfiguration() throws WindowsConfigurationException {
public Response getConfiguration(@HeaderParam("If-Modified-Since") String ifModifiedSince) {
String msg;
PlatformConfiguration tenantConfiguration;
PlatformConfiguration platformConfiguration;
List<ConfigurationEntry> configs;
try {
tenantConfiguration = WindowsAPIUtils.getDeviceManagementService().
platformConfiguration = WindowsAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
if (tenantConfiguration != null) {
configs = tenantConfiguration.getConfiguration();
if (platformConfiguration != null) {
configs = platformConfiguration.getConfiguration();
} else {
tenantConfiguration = new PlatformConfiguration();
platformConfiguration = new PlatformConfiguration();
configs = new ArrayList<>();
}
@ -79,28 +78,29 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY);
entry.setValue(license.getText());
configs.add(entry);
tenantConfiguration.setConfiguration(configs);
platformConfiguration.setConfiguration(configs);
}
} catch (DeviceManagementException e) {
msg = "Error occurred while retrieving the Windows tenant configuration";
msg = "Error occurred while retrieving the Android tenant configuration";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
return tenantConfiguration;
return Response.status(Response.Status.OK).entity(platformConfiguration).build();
}
/**
* Update Tenant Configurations for the specific Device type.
*
* @param configuration Tenant configurations to be updated.
* @param configurations to be updated.
* @return Response message.
* @throws WindowsConfigurationException
*/
@PUT
public Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException {
public Response updateConfiguration(PlatformConfiguration windowsPlatformConfiguration) throws WindowsConfigurationException {
String message;
Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null;
PlatformConfiguration configuration = new PlatformConfiguration();
try {
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
List<ConfigurationEntry> configs = configuration.getConfiguration();
@ -123,14 +123,14 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
configuration.setConfiguration(configs);
WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
Response.status(Response.Status.CREATED);
responseMsg.setResponseMessage("Windows platform configuration succeeded.");
responseMsg.setResponseCode(Response.Status.CREATED.toString());
} catch (DeviceManagementException e) {
message = "Error occurred while modifying configuration settings of Windows platform.";
log.error(message, e);
throw new WindowsConfigurationException(message, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(message).build());
}
return responseMsg;
return Response.status(Response.Status.OK).entity("Android platform configuration has been updated successfully.").build();
}
@GET

@ -1,157 +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.mobile.windows.api.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService;
import javax.jws.WebService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
/**
* Windows Device Management REST-API implementation.
* All end points supports JSON, XMl with content negotiation.
*/
@WebService
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class DeviceManagementServiceImpl implements DeviceManagementService {
private static Log log = LogFactory.getLog(
org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl.class);
/**
* Get all devices.Returns list of Windows devices registered in MDM.
*
* @return Returns retrieved devices.
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
*/
@GET
public List<Device> getAllDevices() throws WindowsConfigurationException {
String msg;
List<Device> devices;
try {
devices = WindowsAPIUtils.getDeviceManagementService().
getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
} catch (DeviceManagementException e) {
msg = "Error occurred while fetching the device list.";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
}
return devices;
}
/**
* Fetch Windows device details of a given device Id.
*
* @param deviceId Device Id
* @return Returns retrieved device.
* @throws WindowsConfigurationException occurred while getting device from DB.
*/
@GET
@Path("{id}")
public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException {
String msg;
Device device;
try {
DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
if (device == null) {
Response.status(Response.Status.NOT_FOUND);
}
} catch (DeviceManagementException e) {
msg = "Error occurred while fetching the device information.";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
}
return device;
}
/**
* Update Windows device details of given device id.
*
* @param deviceId Device Id.
* @param device Device details to be updated.
* @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info.
*/
@PUT
@Path("{id}")
public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException {
String msg;
Message responseMessage = new Message();
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
boolean isUpdated;
try {
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
isUpdated = WindowsAPIUtils.getDeviceManagementService().updateDeviceInfo(deviceIdentifier, device);
if (isUpdated) {
Response.status(Response.Status.ACCEPTED);
responseMessage.setResponseMessage("Device information has modified successfully.");
} else {
Response.status(Response.Status.NOT_MODIFIED);
responseMessage.setResponseMessage("Device not found for the update.");
}
} catch (DeviceManagementException e) {
msg = "Error occurred while modifying the device information.";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
}
return responseMessage;
}
/**
* Fetch the Licence agreement for specific windows platform.
*
* @return Returns License agreement.
* @throws WindowsConfigurationException occurred while getting licence for specific platform and Language.
*/
@GET
@Path("license")
@Produces("application/json")
public License getLicense() throws WindowsConfigurationException {
License license;
try {
license =
WindowsAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Windows device enrollment";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
}
return license;
}
}

@ -1,71 +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.mobile.windows.api.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.PolicyManagementService;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.jws.WebService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@WebService
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class PolicyManagementServiceImpl implements PolicyManagementService {
private static Log log = LogFactory.getLog(
org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.PolicyManagementServiceImpl.class);
@GET
@Path("{deviceId}")
public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader,
@PathParam("deviceId") String deviceId) throws WindowsConfigurationException {
DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
Message responseMessage = new Message();
Policy policy;
try {
PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService();
policy = policyManagerService.getEffectivePolicy(deviceIdentifier);
if (policy == null) {
responseMessage.setResponseCode(Response.Status.NO_CONTENT.toString());
responseMessage.setResponseMessage("No effective policy found");
return responseMessage;
} else {
responseMessage.setResponseCode(Response.Status.OK.toString());
responseMessage.setResponseMessage("Effective policy added to operation");
return responseMessage;
}
} catch (PolicyManagementException e) {
String msg = "Error occurred while getting the policy.";
log.error(msg, e);
throw new WindowsConfigurationException(msg, e);
}
}
}

@ -18,8 +18,10 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml;
import io.swagger.annotations.*;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
@ -35,14 +37,85 @@ import javax.ws.rs.core.Response;
/**
* Interface for Syncml message flow.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Syncml Endpoint"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/syncml"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows syncml service",
description = "This carries all the resources related to Windows syncml message flow.")
@Path("/devicemanagement")
public interface SyncmlService {
@Path("/request")
@POST
@Consumes({ PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML})
@Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML})
@Produces(PluginConstants.SYNCML_MEDIA_TYPE)
@ApiOperation(
httpMethod = "POST",
value = "Getting pending operations for Windows device.",
notes = "Using this API to fetching more information to enroll the Device and " +
"getting pending operations.",
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/enroll/windows",
description = "Getting pending operations and " +
"device information to enroll the device")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Ok. \n Successfully getting pending operations.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified. \n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while getting pending operations.")
})
Response getResponse(Document request) throws WindowsDeviceEnrolmentException, WindowsOperationException,
NotificationManagementException, WindowsConfigurationException;
NotificationManagementException, WindowsConfigurationException;
}

@ -235,7 +235,6 @@ public class SyncmlServiceImpl implements SyncmlService {
String devLang;
String vendor;
String macAddress;
String resolution;
String modVersion;
boolean status = false;
String user;
@ -287,7 +286,6 @@ public class SyncmlServiceImpl implements SyncmlService {
vendor = itemList.get(PluginConstants.SyncML.VENDOR_POSITION).getData();
devMod = itemList.get(PluginConstants.SyncML.MODEL_POSITION).getData();
macAddress = itemList.get(PluginConstants.SyncML.MAC_ADDRESS_POSITION).getData();
resolution = itemList.get(PluginConstants.SyncML.RESOLUTION_POSITION).getData();
deviceName = itemList.get(PluginConstants.SyncML.DEVICE_NAME_POSITION).getData();
DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument.
getHeader().getSource().getLocURI());
@ -320,24 +318,16 @@ public class SyncmlServiceImpl implements SyncmlService {
macAddressProperty.setValue(macAddress);
existingProperties.add(macAddressProperty);
// Device.Property resolutionProperty = new Device.Property();
// resolutionProperty.setName(PluginConstants.SyncML.DEVICE_INFO);
// resolutionProperty.setValue("null");
// existingProperties.add(resolutionProperty);
Device.Property deviceNameProperty = new Device.Property();
deviceNameProperty.setName(PluginConstants.SyncML.DEVICE_NAME);
deviceNameProperty.setValue(deviceName);
existingProperties.add(deviceNameProperty);
Device.Property deviceModelProperty = new Device.Property();
deviceNameProperty.setName(PluginConstants.SyncML.MODEL);
deviceNameProperty.setValue(devMod);
deviceModelProperty.setName(PluginConstants.SyncML.MODEL);
deviceModelProperty.setValue(devMod);
existingProperties.add(deviceModelProperty);
existingDevice.setName(deviceName);
existingDevice.setProperties(existingProperties);
existingDevice.setDeviceIdentifier(syncmlDocument.getHeader().getSource().getLocURI());
existingDevice.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
status = WindowsAPIUtils.getDeviceManagementService().modifyEnrollment(existingDevice);
// call effective policy for the enrolling device.
PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService();

@ -17,6 +17,7 @@
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep;
import io.swagger.annotations.*;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
@ -26,6 +27,11 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.Reques
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.ws.BindingType;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@ -35,6 +41,24 @@ import java.io.UnsupportedEncodingException;
/**
* Interface of WSTEP implementation.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows enrollment service provider"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/deviceenrolment/wstep"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows Enrollment service Management",
description = "This carries all the resources related to Windows enrollment service.")
@WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "wstep")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public interface CertificateEnrollmentService {
@ -44,20 +68,73 @@ public interface CertificateEnrollmentService {
@WebMethod(operationName = "RequestSecurityToken")
@ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace =
PluginConstants.WS_TRUST_TARGET_NAMESPACE)
@POST
@ApiOperation(
httpMethod = "POST",
value = "Signing the certificate signing request(CSR) and provide request security token response.",
notes = "Using this API to fetching more information to enroll the Device and " +
"getting pending operations.",
tags = "Windows Device Enrollment Service.",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/enroll/windows",
description = "GSigning the certificate signing request(CSR) " +
"and provide request security token response")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "Ok.Successfully signed the CSR.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified. \n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while Signing the CSR.")
})
void requestSecurityToken(
@WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
String tokenType,
String tokenType,
@WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
String requestType,
String requestType,
@WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants
.WS_SECURITY_TARGET_NAMESPACE)
String binarySecurityToken,
String binarySecurityToken,
@WebParam(name = "AdditionalContext", targetNamespace = PluginConstants
.SOAP_AUTHORIZATION_TARGET_NAMESPACE)
AdditionalContext additionalContext,
AdditionalContext additionalContext,
@WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse",
targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
javax.xml.ws.Holder<RequestSecurityTokenResponse> response) throws
WindowsDeviceEnrolmentException, UnsupportedEncodingException,
WAPProvisioningException;
javax.xml.ws.Holder<RequestSecurityTokenResponse> response) throws
WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException;
}

@ -18,12 +18,18 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep;
import io.swagger.annotations.*;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.BindingType;
import javax.xml.ws.Holder;
@ -34,6 +40,25 @@ import javax.xml.ws.soap.SOAPBinding;
/**
* Interface for MS-XCEP implementation.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@io.swagger.annotations.Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Enrollment policy service"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/certificatepolicy/xcep"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows enrollment policy Management",
description = "This carries all the resources related to Windows enrollment policy.")
@WebService(targetNamespace = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE,
name = "IPolicy")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
@ -45,7 +70,64 @@ public interface CertificateEnrollmentPolicyService {
@WebMethod(operationName = "GetPolicies")
@ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = PluginConstants.
ENROLLMENT_POLICY_TARGET_NAMESPACE, className = PluginConstants.
RESPONSE_WRAPPER_CLASS_NAME) void getPolicies(
RESPONSE_WRAPPER_CLASS_NAME)
@POST
@Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML})
@Produces(PluginConstants.SYNCML_MEDIA_TYPE)
@ApiOperation(
httpMethod = "POST",
value = "Getting pending operations for Windows device.",
notes = "Using this API to fetching more information to enroll the Device and " +
"getting pending operations.",
tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization(
value = "permission",
scopes = {@AuthorizationScope(
scope = "/device-mgt/devices/enroll/windows",
description = "Getting pending operations and " +
"device information to enroll the device")}
)
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Ok. \n Successfully getting pending operations.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the activity instance that refers to the scheduled operation."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified. \n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while getting pending operations.")
})
void getPolicies(
@WebParam(name = "client", targetNamespace = PluginConstants.
ENROLLMENT_POLICY_TARGET_NAMESPACE)
Client client,

@ -33,7 +33,12 @@
<jaxrs:server id="DiscoveryService_rest" address="/discovery/get">
<jaxrs:serviceBeans>
<ref bean="discoveryService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
<!--Discovery Service POST Endpoint-->
@ -88,43 +93,39 @@
</jaxws:handlers>
</jaxws:endpoint>
<!--WSTEP Endpoint for OnPremise Auth-Policy-->
<jaxws:endpoint
id="CertificateEnrollmentServiceOnPremise"
implementor="org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.impl.CertificateEnrollmentServiceImpl"
address="/deviceenrolment/wstep/onpremise">
<jaxws:properties>
<entry key="ws-security.ut.validator" value-ref="customvalidatoronpremise"/>
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="wss4jInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:handlers>
<ref bean="serviceOptionsHandler"/>
</jaxws:handlers>
</jaxws:endpoint>
<!--Syncml Endpoint-->
<jaxrs:server id="Syncmlinitial" address="/syncml">
<jaxrs:serviceBeans>
<ref bean="Syncml_initial_bean"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
<!--BST provider Endpoint for returning binary security token after authentication-->
<jaxrs:server id="bstprovider" address="/federated">
<jaxrs:serviceBeans>
<ref bean="bstProviderService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
<!--Endpoint for UI admin operations-->
<jaxrs:server id="adminoperations" address="/windows">
<jaxrs:serviceBeans>
<ref bean="deviceMgtAdminService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
@ -132,32 +133,12 @@
<jaxrs:server id="configurationService" address="/configuration">
<jaxrs:serviceBeans>
<ref bean="configurationMgtService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="errorHandler"/>
</jaxrs:providers>
</jaxrs:server>
<!--Endpoint for Policy -->
<jaxrs:server id="policyService" address="/policy">
<jaxrs:serviceBeans>
<ref bean="policyManagementService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="errorHandler"/>
</jaxrs:providers>
</jaxrs:server>
<!--Endpoint for Devicemanager -->
<jaxrs:server id="deviceManagementService" address="/device">
<jaxrs:serviceBeans>
<ref bean="deviceMgtService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="errorHandler"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
@ -186,7 +167,21 @@
</map>
</property>
</bean>
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers" />
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource" />
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="resourcePackage" value="org.wso2.carbon.device.mgt.mobile.windows.api.services"/>
<property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/>
<property name="schemes" value="https" />
<property name="basePath" value="/api/device-mgt/windows/v1.0"/>
<property name="title" value="Windows Device Management API Definitions"/>
<property name="contact" value="dev@wso2.org"/>
<property name="license" value="Apache 2.0"/>
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
<property name="scan" value="true"/>
</bean>
<bean id="Syncml_initial_bean"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl.SyncmlServiceImpl"/>
<bean id="customvalidator"
@ -198,10 +193,6 @@
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.mobile.windows.api.common.util.GsonMessageBodyHandler"/>
<bean id="configurationMgtService"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.ConfigurationMgtServiceImpl"/>
<bean id="policyManagementService"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.PolicyManagementServiceImpl"/>
<bean id="errorHandler" class="org.wso2.carbon.device.mgt.mobile.windows.api.common.util.ErrorHandler"/>
<bean id="deviceMgtService"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl"/>
</beans>

@ -43,7 +43,7 @@
</servlet>
<servlet-mapping>
<servlet-name>JAXServlet-windows</servlet-name>
<url-pattern>/services/*</url-pattern>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
@ -66,7 +66,7 @@
</context-param>
<context-param>
<param-name>nonSecuredEndPoints</param-name>
<param-value>/services/discovery/get,/services/discovery/post,/services/certificatepolicy/xcep,
,/services/deviceenrolment/wstep,/services/syncml/devicemanagement/request</param-value>
<param-value>/discovery/get,/discovery/post,/certificatepolicy/xcep,
,/deviceenrolment/wstep,/syncml/devicemanagement/request</param-value>
</context-param>
</web-app>

@ -34,7 +34,7 @@
}
},
"androidAgentApp" : "android-agent.apk",
"windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/services/federated/bst/authentication",
"windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/federated/bst/authentication",
"ssoConfiguration" : {
"enabled" : false,
"issuer" : "mdm",

@ -312,7 +312,7 @@ deviceModule = function () {
var url;
var license;
if (deviceType == "windows") {
url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/services/configuration/license";
url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/configuration/license";
} else if (deviceType == "ios") {
url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/";
}

Loading…
Cancel
Save