diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java index 302fd5b92..897a7d2bb 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java @@ -352,12 +352,10 @@ public final class PluginConstants { private WindowsEnrollmentProperties() { throw new AssertionError(); } - public static final String DEVICE_NAME = "DeviceName"; public static final String DEVICE_VERSION = "OSVersion"; public static final String DEVICE_ID = "DeviceID"; public static final String IMEI = "MobileEquipmentId"; public static final String TYPE = "DeviceType"; - } } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/StatusTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/StatusTag.java index 157ff3411..4c82b8a56 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/StatusTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/StatusTag.java @@ -43,6 +43,7 @@ public class StatusTag { this.targetReference = targetReference; this.data = data; } + public StatusTag(int commandId, int messageReference, int commandReference, String command, ChallengeTag challengeTag, String targetReference, String data) { this.commandId = commandId; @@ -142,15 +143,12 @@ public class StatusTag { status.appendChild(targetReference); } if (getChallenge() != null) { - getChallenge().buildChallengeElement(doc, status); } - if (getData() != null) { Element data = doc.createElement(Constants.DATA); data.appendChild(doc.createTextNode(getData())); status.appendChild(data); } } - } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java index 0cc07df23..fd5cf76eb 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java @@ -244,10 +244,8 @@ public class OperationHandler { updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations); } } - } - public void updateDeviceInfoStatus(DeviceIdentifier deviceIdentifier) throws OperationManagementException { List pendingDeviceInfoOperations; try { @@ -669,14 +667,12 @@ public class OperationHandler { public void checkForDeviceWipe(List pendingDeviceInfoOperations , DeviceIdentifier deviceIdentifier) throws OperationManagementException { - for (Operation operation : pendingDeviceInfoOperations) { if (PluginConstants.OperationCodes.WIPE_DATA.equals(operation.getCode())) { operation.setStatus(Operation.Status.COMPLETED); updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations); } } - } } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java index 0d8252dee..389dd0cdc 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java @@ -161,7 +161,6 @@ public class OperationReply { } private SyncmlBody generateStatuses() { - SyncmlBody sourceSyncmlBody = syncmlDocument.getBody(); SyncmlHeader sourceHeader = syncmlDocument.getHeader(); StatusTag headerStatus; @@ -183,7 +182,6 @@ public class OperationReply { } else { for (StatusTag sourceStatus : sourceStatuses) { if (sourceStatus.getChallenge() != null && HEADER_COMMAND_TEXT.equals(sourceStatus.getCommand())) { - headerStatus = new StatusTag(headerCommandId, sourceHeader.getMsgID(), HEADER_STATUS_ID, HEADER_COMMAND_TEXT, challengeTag, sourceHeader.getSource().getLocURI(), @@ -239,7 +237,6 @@ public class OperationReply { private void appendOperations(SyncmlBody syncmlBody) throws PolicyManagementException, FeatureManagementException, JSONException, SyncmlOperationException { - GetTag getElement = new GetTag(); List getElements = new ArrayList<>(); List executeElements = new ArrayList<>(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java index e7cd34494..558cd601b 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java @@ -100,7 +100,6 @@ public class EnrollmentServiceImpl implements EnrollmentService { AdditionalContext additionalContext, Holder response) throws WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException { - String headerBinarySecurityToken = null; String headerTo = null; String encodedWap; @@ -221,14 +220,12 @@ public class EnrollmentServiceImpl implements EnrollmentService { String signedCertEncodedString; X509Certificate signedCertificate; String provisioningXmlString; - CertificateManagementServiceImpl certMgtServiceImpl = CertificateManagementServiceImpl.getInstance(); Base64 base64Encoder = new Base64(); try { X509Certificate rootCACertificate = (X509Certificate) certMgtServiceImpl.getCACertificate(); rootCertEncodedString = base64Encoder.encodeAsString(rootCACertificate.getEncoded()); - signedCertificate = certMgtServiceImpl.getSignedCertificateFromCSR(binarySecurityToken); signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); @@ -313,7 +310,6 @@ public class EnrollmentServiceImpl implements EnrollmentService { Node pollValue = pollingAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); pollValue.setTextContent(pollingFrequency); provisioningXmlString = convertDocumentToString(document); - } catch (ParserConfigurationException e) { throw new WAPProvisioningException("Problem occurred while creating configuration request", e); } catch (CertificateEncodingException e) { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java index 1525566b4..5b8d52a44 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java @@ -89,20 +89,16 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { (PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) { if (syncmlHeader.getCredential() != null) { token = syncmlHeader.getCredential().getData(); - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token); DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user); PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonCtx.setTenantId(cacheToken.getTenanatID(), true); - if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) { - if (modifyEnrollWithMoreDetail(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) { pendingOperations = operationHandler.getPendingOperations(syncmlDocument); operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier); response = operationReply.generateReply(syncmlDocument, pendingOperations); return Response.status(Response.Status.OK).entity(response).build(); - } else { String msg = "Error occurred in while modify the enrollment."; log.error(msg); @@ -113,7 +109,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { log.error(msg); return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); } - } else { return Response.ok().entity(operationReply.generateReply(syncmlDocument, null)).build(); } @@ -121,7 +116,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { if (DeviceUtil.getTokenEntryFromDeviceId(deviceIdentifier.getId()) == null) { if (syncmlHeader.getCredential() != null) { token = syncmlHeader.getCredential().getData(); - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token); DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user); PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); @@ -193,7 +187,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { boolean status = false; String user; SyncmlDocument syncmlDocument; - try { syncmlDocument = SyncmlParser.parseSyncmlPayload(request); ReplaceTag replace = syncmlDocument.getBody().getReplace(); @@ -218,7 +211,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); if (!existingDevice.getProperties().isEmpty()) { List existingProperties = new ArrayList<>(); - + Device.Property vendorProperty = new Device.Property(); vendorProperty.setName(PluginConstants.SyncML.VENDOR); vendorProperty.setValue(devMan);