Merge branch 'release-3.0.x' of https://github.com/wso2/carbon-device-mgt-plugins into release-3.0.x

revert-dabc3590
inoshperera 8 years ago
commit 7da5ae239b

@ -689,26 +689,29 @@ function intializeWebsocketUrls() {
wso2.gadgets.state.getGlobalState(function (state) {
deviceId = state.device.id;
deviceType = state.device.type;
var hostname = window.parent.location.hostname;
var port = window.parent.location.port;
if (deviceId && deviceType) {
//TODO need to get the token
wso2.gadgets.identity.getUsername(function (username) {
$.getJSON("/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/get_server_info.jag?username=" + username, function (data) {
webSocketURL = 'wss://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?deviceId=" + deviceId + "&deviceType=" + deviceType;
alertWebSocketURL = 'wss://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?deviceId=" + deviceId + "&deviceType=" + deviceType;
document.cookie = "websocket-token=619e6170-10e8-31f0-904b-b7770d53e545; path=/";
$("#proximity_alert").hide();
initializeWebSocket();
initializeOnAlertWebSocket();
wso2.gadgets.identity.getAccessToken(function (accessToken) {
$.getJSON("/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/get_server_info.jag?username=" + username, function (data) {
webSocketURL = 'wss://' + hostname + ':' + port + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?deviceId=" + deviceId + "&deviceType=" + deviceType;
alertWebSocketURL = 'wss://' + hostname + ':' + port + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?deviceId=" + deviceId + "&deviceType=" + deviceType;
document.cookie = "websocket-token=" + accessToken + "; path=/";
$("#proximity_alert").hide();
initializeWebSocket();
initializeOnAlertWebSocket();
});
});
});
} else {

@ -116,7 +116,7 @@ public class SenseClientAsyncExecutor extends AsyncTask<String, Void, Map<String
TokenIssuerService tokenIssuerService = Feign.builder().client(disableHostnameVerification).requestInterceptor(
new BasicAuthRequestInterceptor(apiApplicationKey.getConsumerKey(), apiApplicationKey.getConsumerSecret()))
.contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder())
.target(TokenIssuerService.class, endpoint + SenseConstants.TOKEN_ISSUER_CONTEXT);
.target(TokenIssuerService.class, endpoint);
accessTokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password, "device_" + deviceId);
//DeviceRegister

@ -39,7 +39,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/hostname"
android:id="@+id/hostname"
android:text="https://localhost:9443"
android:text="https://localhost:8243"
android:inputType="text"
android:maxLines="1" android:singleLine="true"/>

@ -1,7 +1,7 @@
<resources>
<string name="app_name">WSO2-SenseAgent</string>
<string name="title_activity_sense_settings">Sense Settings</string>
<string name="hostname">Server URL https://host:9443</string>
<string name="hostname">Server URL https://host:8243</string>
<string name="speakup">Speakup to capture the words</string>
<string name="action_settings">DeEnroll</string>
<string name="title_activity_activity_select_sensor">ActivitySelectSensor</string>

@ -73,4 +73,20 @@
</div>
</div>
</div>
<div class="panel panel-default tab-pane"
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
<div class="panel-heading">Map</div>
<div id="chartWrapper">
</div>
<a class="padding-left"
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-statistics fw-stack-1x"></i>
</span> View Device Location
</a>
</div>
{{/zone}}

@ -28,10 +28,13 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}};
return {
"device": device.content,
"autoCompleteParams": autoCompleteParams,
"encodedFeaturePayloads": ""
"encodedFeaturePayloads": "",
"portalUrl" : devicemgtProps['portalURL'],
"anchor" : JSON.stringify(anchor)
};
} else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");

@ -111,7 +111,7 @@ public class FireAlarmHTTPCommunicator extends HTTPTransportHandler {
AgentManager agentManager = AgentManager.getInstance();
String pathContext = request.getPathInfo();
String separator = File.separator;
String separator = File.separatorChar=='\\' ? "\\\\" : File.separator ;
if (pathContext.toUpperCase().contains(
separator + AgentConstants.TEMPERATURE_CONTROL)) {

@ -83,6 +83,7 @@
org.wso2.carbon.event.input.adapter.core,
org.wso2.carbon.event.input.adapter.core.exception,
org.jivesoftware.smack.*,
javax.xml,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",

@ -6,6 +6,7 @@ import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.exception.VirtualFirealarmConfigurationException;
import org.wso2.carbon.utils.CarbonUtils;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
@ -50,6 +51,7 @@ public class VirtualFirealarmConfig {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {

@ -134,6 +134,7 @@
</Export-Package>
<Import-Package>
org.wso2.carbon.event.output.adapter.core.*,
javax.xml,
javax.xml.namespace; version=0.0.0,
org.apache.axis2,
org.apache.axis2.client,

@ -75,7 +75,8 @@ public class WebsocketConfig {
return websocketValidationConfigs;
}
public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) {
websocketValidationConfigs = websocketValidationConfigs;
public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigsTemp) {
websocketValidationConfigs = websocketValidationConfigsTemp;
}
}

@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.util;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
@ -34,6 +35,7 @@ public class WebsocketUtils {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {

@ -300,7 +300,7 @@ public class AndroidDeviceInfo extends DeviceInfo implements Serializable {
}
public Date getUpdatedTime() {
if(this.updatedTime.equals((Object)null)) {
if(this.updatedTime == null) {
this.updatedTime = new Date();
}

@ -83,13 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
try {
Type jsonType;
if (type.equals(type)) {
jsonType = type;
} else {
jsonType = type;
}
getGson().toJson(object, jsonType, writer);
getGson().toJson(object, type, writer);
} finally {
writer.close();
}

@ -121,9 +121,9 @@ if (uriMatcher.match("/{context}/api/user/authenticate")) {
} else {
userRoles = String(addUserFormData.userRoles).split(",");
}
if (username.length < devicemgtProps.usernameLength) {
log.error("Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long");
result = "Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long";
if (username.length < devicemgtProps.userValidationConfig.usernameLength) {
log.error("Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long");
result = "Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long";
} else {
try {
result = userModule.addUser(username, firstname, lastname, emailAddress, userRoles);

@ -1,6 +1,5 @@
{
"appContext" : "/android-web-agent/",
"apiContext" : "api",
"httpsURL" : "%https.ip%",
"httpURL" : "%http.ip%",
"enrollmentDir": "/android-web-agent/enrollment",
@ -24,7 +23,9 @@
"tokenServiceURL": "%https.ip%/oauth2/token"
},
"adminUser":"admin",
"usernameLength":30,
"userValidationConfig" : {
"usernameLength":30
},
"device" : {
"ios" : {
"location" : "%http.ip%/android-web-agent/public/mdm.page.enrollments.ios.download-agent/asset/ios-agent.ipa",
@ -35,16 +36,6 @@
},
"androidAgentApp" : "android-agent.apk",
"windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/services/federated/bst/authentication",
"ssoConfiguration" : {
"enabled" : false,
"issuer" : "mdm",
"appName" : "admin_android-web-agent",
"identityProviderURL" : "%https.ip%/sso/samlsso.jag",
"responseSigningEnabled" : "true",
"keyStorePassword" : "wso2carbon",
"identityAlias" : "wso2carbon",
"keyStoreName" : "/repository/resources/security/wso2carbon.jks"
},
"generalConfig" : {
"host" : "%http.ip%",
"companyName" : "WSO2 Enterprise Mobility Manager",

@ -59,6 +59,7 @@
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.xml,
javax.xml.bind.*,
javax.sql,
javax.xml.parsers; version=0.0.0,

@ -38,6 +38,7 @@ import org.wso2.carbon.registry.api.RegistryException;
import org.wso2.carbon.registry.api.Resource;
import org.wso2.carbon.registry.core.Registry;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
@ -66,6 +67,7 @@ public class MobileDeviceManagementUtil {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {

@ -82,13 +82,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
try {
Type jsonType;
if (type.equals(type)) {
jsonType = type;
} else {
jsonType = type;
}
getGson().toJson(object, jsonType, writer);
getGson().toJson(object, type, writer);
} finally {
writer.close();
}

@ -187,10 +187,10 @@ public class WindowsAPIUtils {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
AuthenticatorConfigService authenticatorConfigService =
(AuthenticatorConfigService) ctx.getOSGiService(AuthenticatorConfigService.class, null);
AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST");
if (authenticatorConfigService == null) {
throw new IllegalStateException("AuthenticatorConfiguration service has not initialized.");
}
AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST");
if (authenticatorConfig == null) {
throw new IllegalStateException("BST authenticatorConfig has not initialized.");
}

@ -181,7 +181,7 @@ public class OperationHandler {
if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) {
pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier);
for (Operation operation : pendingDataOperations) {
if ((OperationCode.Command.DEVICE_RING.equals(operation.getCode())) &&
if ((OperationCode.Command.DEVICE_RING.getCode().equals(operation.getCode())) &&
(operation.getId() == status.getCommandReference())) {
operation.setStatus(Operation.Status.COMPLETED);
updateStatus(syncmlDocument.getHeader().getSource().getLocURI(),
@ -213,7 +213,7 @@ public class OperationHandler {
}
for (Operation operation : pendingDataOperations) {
if ((OperationCode.Command.WIPE_DATA.equals(operation.getCode())) &&
if ((OperationCode.Command.WIPE_DATA.getCode().equals(operation.getCode())) &&
(operation.getId() == status.getCommandReference())) {
operation.setStatus(Operation.Status.COMPLETED);
updateStatus(syncmlDocument.getHeader().getSource().getLocURI(),
@ -306,13 +306,13 @@ public class OperationHandler {
if (status.getTargetReference() == null) {
updateDeviceOperations(status, syncmlDocument, deviceIdentifier);
} else {
if ((OperationCode.Command.DEVICE_LOCK.equals(status.getTargetReference()))) {
if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(status.getTargetReference()))) {
updateLockOperation(status, syncmlDocument, deviceIdentifier);
}
if ((OperationCode.Command.DEVICE_RING.equals(status.getTargetReference()))) {
if ((OperationCode.Command.DEVICE_RING.getCode().equals(status.getTargetReference()))) {
ring(status, syncmlDocument, deviceIdentifier);
}
if (equals(OperationCode.Command.WIPE_DATA.equals(status.getTargetReference()))) {
if ((OperationCode.Command.WIPE_DATA.getCode().equals(status.getTargetReference()))) {
dataWipe(status, syncmlDocument, deviceIdentifier);
}
}

@ -51,6 +51,7 @@ import org.xml.sax.SAXException;
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.servlet.ServletContext;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@ -102,7 +103,7 @@ public class EnrollmentServiceImpl implements EnrollmentService {
String headerTo = null;
String encodedWap;
List<Header> headers = getHeaders();
for (Header headerElement : headers != null ? headers : null) {
for (Header headerElement : headers) {
String nodeName = headerElement.getName().getLocalPart();
if (PluginConstants.SECURITY.equals(nodeName)) {
Element element = (Element) headerElement.getObject();
@ -231,6 +232,7 @@ public class EnrollmentServiceImpl implements EnrollmentService {
signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded());
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder builder;
builder = domFactory.newDocumentBuilder();

@ -112,7 +112,7 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe
String headerTo = null;
String encodedWap;
List<Header> headers = getHeaders();
for (Header headerElement : headers != null ? headers : null) {
for (Header headerElement : headers) {
String nodeName = headerElement.getName().getLocalPart();
if (PluginConstants.SECURITY.equals(nodeName)) {
Element element = (Element) headerElement.getObject();

@ -121,9 +121,9 @@ if (uriMatcher.match("/{context}/api/user/authenticate")) {
} else {
userRoles = String(addUserFormData.userRoles).split(",");
}
if (username.length < devicemgtProps.usernameLength) {
log.error("Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long");
result = "Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long";
if (username.length < devicemgtProps.userValidationConfig.usernameLength) {
log.error("Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long");
result = "Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long";
} else {
try {
result = userModule.addUser(username, firstname, lastname, emailAddress, userRoles);

@ -1,6 +1,5 @@
{
"appContext" : "/windows-web-agent/",
"apiContext" : "api",
"httpsURL" : "%https.ip%",
"httpURL" : "%http.ip%",
"enrollmentDir": "/windows-web-agent/enrollment",
@ -24,7 +23,9 @@
"tokenServiceURL": "%https.ip%/oauth2/token"
},
"adminUser":"admin",
"usernameLength":30,
"userValidationConfig": {
"usernameLength":30
},
"device" : {
"ios" : {
"location" : "%http.ip%/windows-web-agent/public/mdm.page.enrollments.ios.download-agent/asset/ios-agent.ipa",
@ -35,16 +36,6 @@
},
"androidAgentApp" : "android-agent.apk",
"windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/federated/bst/authentication",
"ssoConfiguration" : {
"enabled" : false,
"issuer" : "mdm",
"appName" : "admin_windows-web-agent",
"identityProviderURL" : "%https.ip%/sso/samlsso.jag",
"responseSigningEnabled" : "true",
"keyStorePassword" : "wso2carbon",
"identityAlias" : "wso2carbon",
"keyStoreName" : "/repository/resources/security/wso2carbon.jks"
},
"generalConfig" : {
"host" : "%http.ip%",
"companyName" : "WSO2 Enterprise Mobility Manager",

@ -142,7 +142,7 @@ var handlers = function () {
"client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
if (devicemgtProps["apimgt-gateway"]) {
if (devicemgtProps["gatewayEnabled"]) {
var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials);
if (!jwtToken) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +

@ -32,7 +32,7 @@ under the License. --}}
{{
unit "mdm.unit.wizard-stepper"
steps = "Start Workplace,
Login to Enterprise Mobility Manager,
Login to WSO2 IoT Server,
Accept End User License Agreement"
currentStep = "Start Workplace"
currentStepIndex = 0
@ -40,7 +40,7 @@ under the License. --}}
Start the Workplace app to continue device enrollment.
<br class="c-both" />
<br class="c-both" />
Setting up a Workplace account with WSO2 Enterprise Mobility Manager
Setting up a Workplace account with WSO2 IoT Server
will offer you company policies, certificates and apps that help you connect
to your business.
<br class="c-both" />

@ -32,7 +32,7 @@ under the License. --}}
{{
unit "mdm.unit.wizard-stepper"
steps = "Start Workplace,
Login to Enterprise Mobility Manager,
Login to WSO2 IoT Server,
Accept End User License Agreement"
currentStep = "Accept End User License Agreement"
currentStepIndex = 2

@ -25,7 +25,7 @@ under the License. --}}
}}
{{/zone}}
{{!-- Inputting content into defined zones in enrollment layout --}}
{{unit "mdm.unit.ui.title" pageTitle="Windows Phone Enrollment | Login to Enterprise Mobility Manager"}}
{{unit "mdm.unit.ui.title" pageTitle="Windows Phone Enrollment | Login to WSO2 IoT Server"}}
{{#zone "headerTitle"}}
Windows Phone Enrollment
{{/zone}}
@ -33,9 +33,9 @@ under the License. --}}
{{
unit "mdm.unit.wizard-stepper"
steps = "Start Workplace,
Login to Enterprise Mobility Manager,
Login to WSO2 IoT Server,
Accept End User License Agreement"
currentStep = "Login to Enterprise Mobility Manager"
currentStep = "Login to WSO2 IoT Server"
currentStepIndex = 1
}}
{{

@ -55,6 +55,7 @@
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.xml,
javax.xml.bind.*,
javax.sql,
javax.naming,

@ -38,6 +38,7 @@ import org.wso2.carbon.registry.api.RegistryException;
import org.wso2.carbon.registry.api.Resource;
import org.wso2.carbon.registry.core.Registry;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
@ -66,6 +67,7 @@ public class MobileDeviceManagementUtil {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {

Loading…
Cancel
Save