|
|
@ -89,20 +89,16 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
(PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) {
|
|
|
|
(PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) {
|
|
|
|
if (syncmlHeader.getCredential() != null) {
|
|
|
|
if (syncmlHeader.getCredential() != null) {
|
|
|
|
token = syncmlHeader.getCredential().getData();
|
|
|
|
token = syncmlHeader.getCredential().getData();
|
|
|
|
|
|
|
|
|
|
|
|
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
|
|
|
|
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
|
|
|
|
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
|
|
|
|
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
|
|
|
|
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
|
|
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
|
|
carbonCtx.setTenantId(cacheToken.getTenanatID(), true);
|
|
|
|
carbonCtx.setTenantId(cacheToken.getTenanatID(), true);
|
|
|
|
|
|
|
|
|
|
|
|
if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) {
|
|
|
|
if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) {
|
|
|
|
|
|
|
|
|
|
|
|
if (modifyEnrollWithMoreDetail(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) {
|
|
|
|
if (modifyEnrollWithMoreDetail(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) {
|
|
|
|
pendingOperations = operationHandler.getPendingOperations(syncmlDocument);
|
|
|
|
pendingOperations = operationHandler.getPendingOperations(syncmlDocument);
|
|
|
|
operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier);
|
|
|
|
operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier);
|
|
|
|
response = operationReply.generateReply(syncmlDocument, pendingOperations);
|
|
|
|
response = operationReply.generateReply(syncmlDocument, pendingOperations);
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
String msg = "Error occurred in while modify the enrollment.";
|
|
|
|
String msg = "Error occurred in while modify the enrollment.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
@ -113,7 +109,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return Response.ok().entity(operationReply.generateReply(syncmlDocument, null)).build();
|
|
|
|
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 (DeviceUtil.getTokenEntryFromDeviceId(deviceIdentifier.getId()) == null) {
|
|
|
|
if (syncmlHeader.getCredential() != null) {
|
|
|
|
if (syncmlHeader.getCredential() != null) {
|
|
|
|
token = syncmlHeader.getCredential().getData();
|
|
|
|
token = syncmlHeader.getCredential().getData();
|
|
|
|
|
|
|
|
|
|
|
|
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
|
|
|
|
MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token);
|
|
|
|
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
|
|
|
|
DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user);
|
|
|
|
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
|
|
PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
|
@ -193,7 +187,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
String user;
|
|
|
|
String user;
|
|
|
|
SyncmlDocument syncmlDocument;
|
|
|
|
SyncmlDocument syncmlDocument;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
syncmlDocument = SyncmlParser.parseSyncmlPayload(request);
|
|
|
|
syncmlDocument = SyncmlParser.parseSyncmlPayload(request);
|
|
|
|
ReplaceTag replace = syncmlDocument.getBody().getReplace();
|
|
|
|
ReplaceTag replace = syncmlDocument.getBody().getReplace();
|
|
|
@ -218,7 +211,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
|
|
|
|
Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
|
|
|
|
if (!existingDevice.getProperties().isEmpty()) {
|
|
|
|
if (!existingDevice.getProperties().isEmpty()) {
|
|
|
|
List<Device.Property> existingProperties = new ArrayList<>();
|
|
|
|
List<Device.Property> existingProperties = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
Device.Property vendorProperty = new Device.Property();
|
|
|
|
Device.Property vendorProperty = new Device.Property();
|
|
|
|
vendorProperty.setName(PluginConstants.SyncML.VENDOR);
|
|
|
|
vendorProperty.setName(PluginConstants.SyncML.VENDOR);
|
|
|
|
vendorProperty.setValue(devMan);
|
|
|
|
vendorProperty.setValue(devMan);
|
|
|
|