adding swagger annotations

revert-dabc3590
Hasunie 8 years ago
parent 54de97ec27
commit 36cbc96713

@ -351,6 +351,20 @@
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <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> <exclusions>
<exclusion> <exclusion>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

@ -189,7 +189,7 @@ public final class PluginConstants {
public static final int MODEL_POSITION = 5; public static final int MODEL_POSITION = 5;
public static final int MAC_ADDRESS_POSITION = 7; public static final int MAC_ADDRESS_POSITION = 7;
public static final int RESOLUTION_POSITION = 8; 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_ONE = "1";
public static final String SYNCML_DATA_ZERO = "0"; public static final String SYNCML_DATA_ZERO = "0";
public static final String OS_VERSION = "OS_VERSION"; public static final String OS_VERSION = "OS_VERSION";

@ -54,7 +54,7 @@ import javax.ws.rs.core.Response;
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Configuration Management"), @ExtensionProperty(name = "name", value = "Windows Configuration Management"),
@ExtensionProperty(name = "context", @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", @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 @WebService
@Path("services/configuration") @Path("/configuration")
@Produces({"application/json", "application/xml"}) @Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"})
public interface ConfigurationMgtService { public interface ConfigurationMgtService {
@GET @GET
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
@ -80,9 +80,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { authorizations = {
@Authorization( @Authorization(
value="permission", value = "permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view", scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
description = "View Configurations") } description = "View Configurations")}
) )
} }
) )
@ -117,7 +117,12 @@ public interface ConfigurationMgtService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.") 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. * Update Tenant Configurations for the specific Device type.
@ -136,9 +141,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { authorizations = {
@Authorization( @Authorization(
value="permission", value = "permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/configurations/manage", scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage",
description = "Manage Configurations") } description = "Manage Configurations")}
) )
} }
) )
@ -175,11 +180,11 @@ public interface ConfigurationMgtService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying the Windows platform configurations.") "Server error occurred while modifying the Windows platform configurations.")
}) })
Message updateConfiguration Response updateConfiguration
( @ApiParam( (@ApiParam(
name = "configuration", name = "configuration",
value = "The properties to update the Windows platform configurations.") value = "The properties to update the Windows platform configurations.")
PlatformConfiguration configuration) throws WindowsConfigurationException; PlatformConfiguration configuration) throws WindowsConfigurationException;
@GET @GET
@Path("license") @Path("license")
@ -194,9 +199,9 @@ public interface ConfigurationMgtService {
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { authorizations = {
@Authorization( @Authorization(
value="permission", value = "permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Enroll Device") } description = "Enroll Device")}
) )
} }
) )
@ -236,7 +241,7 @@ public interface ConfigurationMgtService {
name = "If-Modified-Since", name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" + 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" + "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) required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException; @HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException;

@ -18,13 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
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.apimgt.annotations.api.Permission; 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import javax.jws.WebService; import javax.jws.WebService;
@ -41,7 +37,7 @@ import java.util.List;
* Interface for Admin operations persisting. This interface accepts operations added via UI. * Interface for Admin operations persisting. This interface accepts operations added via UI.
*/ */
@Api(value = "Windows Device Management Administrative Service", @Api(value = "Windows Device Management Administrative Service",
description = "Device management related admin APIs.") description = "Device management related admin APIs.")
@SwaggerDefinition( @SwaggerDefinition(
info = @Info( info = @Info(
@ -68,31 +64,313 @@ public interface DeviceManagementAdminService {
@POST @POST
@Path("/lock-devices") @Path("/lock-devices")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock") @ApiOperation(
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws consumes = MediaType.APPLICATION_JSON,
WindowsDeviceEnrolmentException; 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 @POST
@Path("/disenroll-devices") @Path("/disenroll-devices")
@Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows") @ApiOperation(
Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws consumes = MediaType.APPLICATION_JSON,
WindowsDeviceEnrolmentException; 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 @POST
@Path("/wipe-devices") @Path("/wipe-devices")
@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe") @ApiOperation(
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws consumes = MediaType.APPLICATION_JSON,
WindowsDeviceEnrolmentException; 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 @POST
@Path("/ring-devices") @Path("/ring-devices")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring") @ApiOperation(
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws consumes = MediaType.APPLICATION_JSON,
WindowsDeviceEnrolmentException; 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 @POST
@Path("/lock-reset-devices") @Path("/lock-reset-devices")
@Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock-reset") @ApiOperation(
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds) consumes = MediaType.APPLICATION_JSON,
throws WindowsDeviceEnrolmentException; 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,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; 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.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.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; 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.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
* Interface for handling authentication request comes via MDM login page. * 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") @Path("/bst")
@Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public interface BSTProvider { public interface BSTProvider {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/authentication") @Path("/authentication")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") @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; 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.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;

@ -18,6 +18,8 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery; 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.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; 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; 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.jws.WebService;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.xml.ws.BindingType; import javax.xml.ws.BindingType;
import javax.xml.ws.RequestWrapper; import javax.xml.ws.RequestWrapper;
@ -38,23 +42,142 @@ import javax.xml.ws.soap.SOAPBinding;
/** /**
* Interface for Discovery service related operations. * 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, @WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE,
name = "IDiscoveryService") name = "IDiscoveryService")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public interface DiscoveryService { public interface DiscoveryService {
@POST @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) @RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
@WebMethod(operationName = "Discover") @WebMethod(operationName = "Discover")
@ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) @ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
void discover( void discover(
@WebParam(name = "request", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) @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", @WebParam(mode = WebParam.Mode.OUT, name = "DiscoverResult",
targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE)
javax.xml.ws.Holder<DiscoveryResponse> response javax.xml.ws.Holder<DiscoveryResponse> response
) throws WindowsDeviceEnrolmentException; ) 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 @GET
@WebMethod @WebMethod
@WebResult() @WebResult()

@ -18,6 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans; 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.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -26,15 +29,21 @@ import java.io.Serializable;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DiscoveryRequest") @XmlType(name = "DiscoveryRequest")
@ApiModel(value = "DiscoveryRequest",
description = "Discover request related information.")
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class DiscoveryRequest implements Serializable { 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) @XmlElement(name = "EmailAddress", required = true)
private String emailId; private String emailId;
@ApiModelProperty(name = "version", value = "OS version on the Windows Device.", required = true)
@XmlElement(name = "RequestVersion") @XmlElement(name = "RequestVersion")
private String version; private String version;
@ApiModelProperty(name = "deviceType", value = "Type of the Device(LapTop/Mobile Device).", required = true)
@XmlElement(name = "DeviceType") @XmlElement(name = "DeviceType")
private String 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.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.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; 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.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.ConfigurationMgtService; import org.wso2.carbon.device.mgt.mobile.windows.api.services.ConfigurationMgtService;
@ -55,17 +54,17 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
* @throws WindowsConfigurationException * @throws WindowsConfigurationException
*/ */
@GET @GET
public PlatformConfiguration getConfiguration() throws WindowsConfigurationException { public Response getConfiguration(@HeaderParam("If-Modified-Since") String ifModifiedSince) {
String msg; String msg;
PlatformConfiguration tenantConfiguration; PlatformConfiguration platformConfiguration;
List<ConfigurationEntry> configs; List<ConfigurationEntry> configs;
try { try {
tenantConfiguration = WindowsAPIUtils.getDeviceManagementService(). platformConfiguration = WindowsAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
if (tenantConfiguration != null) { if (platformConfiguration != null) {
configs = tenantConfiguration.getConfiguration(); configs = platformConfiguration.getConfiguration();
} else { } else {
tenantConfiguration = new PlatformConfiguration(); platformConfiguration = new PlatformConfiguration();
configs = new ArrayList<>(); configs = new ArrayList<>();
} }
@ -79,28 +78,29 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY);
entry.setValue(license.getText()); entry.setValue(license.getText());
configs.add(entry); configs.add(entry);
tenantConfiguration.setConfiguration(configs); platformConfiguration.setConfiguration(configs);
} }
} catch (DeviceManagementException e) { } 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); 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. * Update Tenant Configurations for the specific Device type.
* *
* @param configuration Tenant configurations to be updated. * @param configurations to be updated.
* @return Response message. * @return Response message.
* @throws WindowsConfigurationException * @throws WindowsConfigurationException
*/ */
@PUT @PUT
public Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException { public Response updateConfiguration(PlatformConfiguration windowsPlatformConfiguration) throws WindowsConfigurationException {
String message; String message;
Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;
PlatformConfiguration configuration = new PlatformConfiguration();
try { try {
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
List<ConfigurationEntry> configs = configuration.getConfiguration(); List<ConfigurationEntry> configs = configuration.getConfiguration();
@ -123,14 +123,14 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
configuration.setConfiguration(configs); configuration.setConfiguration(configs);
WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
Response.status(Response.Status.CREATED); Response.status(Response.Status.CREATED);
responseMsg.setResponseMessage("Windows platform configuration succeeded.");
responseMsg.setResponseCode(Response.Status.CREATED.toString());
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
message = "Error occurred while modifying configuration settings of Windows platform."; message = "Error occurred while modifying configuration settings of Windows platform.";
log.error(message, e); 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 @GET

@ -1,157 +1,157 @@
/* ///*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. // * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* // *
* WSO2 Inc. licenses this file to you under the Apache License, // * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except // * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. // * in compliance with the License.
* you may obtain a copy of the License at // * you may obtain a copy of the License at
* // *
* http://www.apache.org/licenses/LICENSE-2.0 // * http://www.apache.org/licenses/LICENSE-2.0
* // *
* Unless required by applicable law or agreed to in writing, // * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an // * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the // * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations // * specific language governing permissions and limitations
* under the License. // * under the License.
*/ // */
//
package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl; //package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl;
//
import org.apache.commons.logging.Log; //import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; //import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device; //import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; //import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; //import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; //import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License; //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.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.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; //import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService; //import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService;
//
import javax.jws.WebService; //import javax.jws.WebService;
import javax.ws.rs.*; //import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; //import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; //import javax.ws.rs.core.Response;
import java.util.List; //import java.util.List;
//
/** ///**
* Windows Device Management REST-API implementation. // * Windows Device Management REST-API implementation.
* All end points supports JSON, XMl with content negotiation. // * All end points supports JSON, XMl with content negotiation.
*/ // */
@WebService //@WebService
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) //@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) //@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class DeviceManagementServiceImpl implements DeviceManagementService { //public class DeviceManagementServiceImpl implements DeviceManagementService {
//
//
private static Log log = LogFactory.getLog( // private static Log log = LogFactory.getLog(
org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl.class); // org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl.class);
//
/** // /**
* Get all devices.Returns list of Windows devices registered in MDM. // * Get all devices.Returns list of Windows devices registered in MDM.
* // *
* @return Returns retrieved devices. // * @return Returns retrieved devices.
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB. // * @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
*/ // */
@GET // @GET
public List<Device> getAllDevices() throws WindowsConfigurationException { // public List<Device> getAllDevices() throws WindowsConfigurationException {
String msg; // String msg;
List<Device> devices; // List<Device> devices;
try { // try {
devices = WindowsAPIUtils.getDeviceManagementService(). // devices = WindowsAPIUtils.getDeviceManagementService().
getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); // getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
msg = "Error occurred while fetching the device list."; // msg = "Error occurred while fetching the device list.";
log.error(msg, e); // log.error(msg, e);
throw new WindowsConfigurationException(msg, e); // throw new WindowsConfigurationException(msg, e);
} // }
return devices; // return devices;
} // }
//
/** // /**
* Fetch Windows device details of a given device Id. // * Fetch Windows device details of a given device Id.
* // *
* @param deviceId Device Id // * @param deviceId Device Id
* @return Returns retrieved device. // * @return Returns retrieved device.
* @throws WindowsConfigurationException occurred while getting device from DB. // * @throws WindowsConfigurationException occurred while getting device from DB.
*/ // */
@GET // @GET
@Path("{id}") // @Path("{id}")
public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException { // public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException {
String msg; // String msg;
Device device; // Device device;
try { // try {
DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId); // DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); // device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
if (device == null) { // if (device == null) {
Response.status(Response.Status.NOT_FOUND); // Response.status(Response.Status.NOT_FOUND);
} // }
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
msg = "Error occurred while fetching the device information."; // msg = "Error occurred while fetching the device information.";
log.error(msg, e); // log.error(msg, e);
throw new WindowsConfigurationException(msg, e); // throw new WindowsConfigurationException(msg, e);
} // }
return device; // return device;
} // }
//
/** // /**
* Update Windows device details of given device id. // * Update Windows device details of given device id.
* // *
* @param deviceId Device Id. // * @param deviceId Device Id.
* @param device Device details to be updated. // * @param device Device details to be updated.
* @return Returns the message whether device update or not. // * @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info. // * @throws WindowsConfigurationException occurred while updating the Device Info.
*/ // */
@PUT // @PUT
@Path("{id}") // @Path("{id}")
public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException { // public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException {
String msg; // String msg;
Message responseMessage = new Message(); // Message responseMessage = new Message();
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); // DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId); // deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); // deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
boolean isUpdated; // boolean isUpdated;
try { // try {
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); // device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
isUpdated = WindowsAPIUtils.getDeviceManagementService().updateDeviceInfo(deviceIdentifier, device); // isUpdated = WindowsAPIUtils.getDeviceManagementService().updateDeviceInfo(deviceIdentifier, device);
if (isUpdated) { // if (isUpdated) {
Response.status(Response.Status.ACCEPTED); // Response.status(Response.Status.ACCEPTED);
responseMessage.setResponseMessage("Device information has modified successfully."); // responseMessage.setResponseMessage("Device information has modified successfully.");
} else { // } else {
Response.status(Response.Status.NOT_MODIFIED); // Response.status(Response.Status.NOT_MODIFIED);
responseMessage.setResponseMessage("Device not found for the update."); // responseMessage.setResponseMessage("Device not found for the update.");
} // }
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
msg = "Error occurred while modifying the device information."; // msg = "Error occurred while modifying the device information.";
log.error(msg, e); // log.error(msg, e);
throw new WindowsConfigurationException(msg, e); // throw new WindowsConfigurationException(msg, e);
} // }
return responseMessage; // return responseMessage;
} // }
//
/** // /**
* Fetch the Licence agreement for specific windows platform. // * Fetch the Licence agreement for specific windows platform.
* // *
* @return Returns License agreement. // * @return Returns License agreement.
* @throws WindowsConfigurationException occurred while getting licence for specific platform and Language. // * @throws WindowsConfigurationException occurred while getting licence for specific platform and Language.
*/ // */
@GET // @GET
@Path("license") // @Path("license")
@Produces("application/json") // @Produces("application/json")
public License getLicense() throws WindowsConfigurationException { // public License getLicense() throws WindowsConfigurationException {
License license; // License license;
try { // try {
license = // license =
WindowsAPIUtils.getDeviceManagementService().getLicense( // WindowsAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, // DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); // DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Windows device enrollment"; // String msg = "Error occurred while retrieving the license configured for Windows device enrollment";
log.error(msg, e); // log.error(msg, e);
throw new WindowsConfigurationException(msg, e); // throw new WindowsConfigurationException(msg, e);
} // }
return license; // 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; package org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml;
import io.swagger.annotations.*;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; 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.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; 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. * 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") @Path("/devicemanagement")
public interface SyncmlService { public interface SyncmlService {
@Path("/request") @Path("/request")
@POST @POST
@Consumes({ PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML})
@Produces(PluginConstants.SYNCML_MEDIA_TYPE) @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, Response getResponse(Document request) throws WindowsDeviceEnrolmentException, WindowsOperationException,
NotificationManagementException, WindowsConfigurationException; NotificationManagementException, WindowsConfigurationException;
} }

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

@ -17,6 +17,7 @@
*/ */
package org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep; 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.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; 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.WebMethod;
import javax.jws.WebParam; import javax.jws.WebParam;
import javax.jws.WebService; 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.BindingType;
import javax.xml.ws.RequestWrapper; import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper; import javax.xml.ws.ResponseWrapper;
@ -35,6 +41,24 @@ import java.io.UnsupportedEncodingException;
/** /**
* Interface of WSTEP implementation. * 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") @WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "wstep")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public interface CertificateEnrollmentService { public interface CertificateEnrollmentService {
@ -44,20 +68,73 @@ public interface CertificateEnrollmentService {
@WebMethod(operationName = "RequestSecurityToken") @WebMethod(operationName = "RequestSecurityToken")
@ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace =
PluginConstants.WS_TRUST_TARGET_NAMESPACE) 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( void requestSecurityToken(
@WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) @WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
String tokenType, String tokenType,
@WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) @WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
String requestType, String requestType,
@WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants @WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants
.WS_SECURITY_TARGET_NAMESPACE) .WS_SECURITY_TARGET_NAMESPACE)
String binarySecurityToken, String binarySecurityToken,
@WebParam(name = "AdditionalContext", targetNamespace = PluginConstants @WebParam(name = "AdditionalContext", targetNamespace = PluginConstants
.SOAP_AUTHORIZATION_TARGET_NAMESPACE) .SOAP_AUTHORIZATION_TARGET_NAMESPACE)
AdditionalContext additionalContext, AdditionalContext additionalContext,
@WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse", @WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse",
targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
javax.xml.ws.Holder<RequestSecurityTokenResponse> response) throws javax.xml.ws.Holder<RequestSecurityTokenResponse> response) throws
WindowsDeviceEnrolmentException, UnsupportedEncodingException, WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException;
WAPProvisioningException;
} }

@ -18,12 +18,18 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep; 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.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*; import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*;
import javax.jws.WebMethod; import javax.jws.WebMethod;
import javax.jws.WebParam; import javax.jws.WebParam;
import javax.jws.WebService; 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.bind.annotation.XmlSeeAlso;
import javax.xml.ws.BindingType; import javax.xml.ws.BindingType;
import javax.xml.ws.Holder; import javax.xml.ws.Holder;
@ -34,6 +40,25 @@ import javax.xml.ws.soap.SOAPBinding;
/** /**
* Interface for MS-XCEP implementation. * 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, @WebService(targetNamespace = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE,
name = "IPolicy") name = "IPolicy")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
@ -45,7 +70,64 @@ public interface CertificateEnrollmentPolicyService {
@WebMethod(operationName = "GetPolicies") @WebMethod(operationName = "GetPolicies")
@ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = PluginConstants. @ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = PluginConstants.
ENROLLMENT_POLICY_TARGET_NAMESPACE, className = 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. @WebParam(name = "client", targetNamespace = PluginConstants.
ENROLLMENT_POLICY_TARGET_NAMESPACE) ENROLLMENT_POLICY_TARGET_NAMESPACE)
Client client, Client client,

@ -33,7 +33,12 @@
<jaxrs:server id="DiscoveryService_rest" address="/discovery/get"> <jaxrs:server id="DiscoveryService_rest" address="/discovery/get">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="discoveryService"/> <ref bean="discoveryService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server> </jaxrs:server>
<!--Discovery Service POST Endpoint--> <!--Discovery Service POST Endpoint-->
@ -88,43 +93,39 @@
</jaxws:handlers> </jaxws:handlers>
</jaxws:endpoint> </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--> <!--Syncml Endpoint-->
<jaxrs:server id="Syncmlinitial" address="/syncml"> <jaxrs:server id="Syncmlinitial" address="/syncml">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="Syncml_initial_bean"/> <ref bean="Syncml_initial_bean"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server> </jaxrs:server>
<!--BST provider Endpoint for returning binary security token after authentication--> <!--BST provider Endpoint for returning binary security token after authentication-->
<jaxrs:server id="bstprovider" address="/federated"> <jaxrs:server id="bstprovider" address="/federated">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="bstProviderService"/> <ref bean="bstProviderService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server> </jaxrs:server>
<!--Endpoint for UI admin operations--> <!--Endpoint for UI admin operations-->
<jaxrs:server id="adminoperations" address="/windows"> <jaxrs:server id="adminoperations" address="/windows">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="deviceMgtAdminService"/> <ref bean="deviceMgtAdminService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers> </jaxrs:providers>
</jaxrs:server> </jaxrs:server>
@ -132,35 +133,15 @@
<jaxrs:server id="configurationService" address="/configuration"> <jaxrs:server id="configurationService" address="/configuration">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="configurationMgtService"/> <ref bean="configurationMgtService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
<ref bean="errorHandler"/> <ref bean="errorHandler"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers> </jaxrs:providers>
</jaxrs:server> </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"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="bstProviderService" <bean id="bstProviderService"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.impl.BSTProviderImpl"/> class="org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.impl.BSTProviderImpl"/>
<bean id="deviceMgtAdminService" <bean id="deviceMgtAdminService"
@ -186,7 +167,21 @@
</map> </map>
</property> </property>
</bean> </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" <bean id="Syncml_initial_bean"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl.SyncmlServiceImpl"/> class="org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl.SyncmlServiceImpl"/>
<bean id="customvalidator" <bean id="customvalidator"
@ -198,10 +193,5 @@
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.mobile.windows.api.common.util.GsonMessageBodyHandler"/> <bean id="jsonProvider" class="org.wso2.carbon.device.mgt.mobile.windows.api.common.util.GsonMessageBodyHandler"/>
<bean id="configurationMgtService" <bean id="configurationMgtService"
class="org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.ConfigurationMgtServiceImpl"/> 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> </beans>

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

@ -34,7 +34,7 @@
} }
}, },
"androidAgentApp" : "android-agent.apk", "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" : { "ssoConfiguration" : {
"enabled" : false, "enabled" : false,
"issuer" : "mdm", "issuer" : "mdm",

@ -312,7 +312,7 @@ deviceModule = function () {
var url; var url;
var license; var license;
if (deviceType == "windows") { 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") { } else if (deviceType == "ios") {
url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/"; url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/";
} }

Loading…
Cancel
Save