From 809992fb9f3b20ef88b3464a9a8b7c85cdd4d765 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Mon, 2 Jan 2017 15:33:01 +0530 Subject: [PATCH 1/9] remove hardcoded oauth2 token --- .../geo-dashboard/js/websocket.js | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js index 30fcb20d4..7c27e57f0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js @@ -690,25 +690,26 @@ function intializeWebsocketUrls() { deviceId = state.device.id; deviceType = state.device.type; 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://' + 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="+accessToken+"; path=/"; + $("#proximity_alert").hide(); + initializeWebSocket(); + initializeOnAlertWebSocket(); + }); }); }); } else { From 29cff5ae8ad10de8a126b1f53708fb9e1c7c7c48 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Tue, 3 Jan 2017 13:31:30 +0530 Subject: [PATCH 2/9] fixing the ip resolving issue. --- .../geo-dashboard/js/websocket.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js index 7c27e57f0..ced06d049 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js @@ -689,23 +689,25 @@ 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) { wso2.gadgets.identity.getUsername(function (username) { 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://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance + 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://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance + 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=/"; + document.cookie = "websocket-token=" + accessToken + "; path=/"; $("#proximity_alert").hide(); initializeWebSocket(); initializeOnAlertWebSocket(); From 838223c67ad743a2863d290de04460994d160dd1 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 4 Jan 2017 00:18:28 +0530 Subject: [PATCH 3/9] Removed unneccesary configs --- .../android-web-agent/app/conf/config.json | 11 ----------- .../windows-web-agent/app/conf/config.json | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json index 75943b23b..2b5eb8a4f 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json @@ -1,6 +1,5 @@ { "appContext" : "/android-web-agent/", - "apiContext" : "api", "httpsURL" : "%https.ip%", "httpURL" : "%http.ip%", "enrollmentDir": "/android-web-agent/enrollment", @@ -35,16 +34,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", diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json index d02ddd740..848d467bf 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json @@ -1,6 +1,5 @@ { "appContext" : "/windows-web-agent/", - "apiContext" : "api", "httpsURL" : "%https.ip%", "httpURL" : "%http.ip%", "enrollmentDir": "/windows-web-agent/enrollment", @@ -35,16 +34,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", From 2550096cea810dd4d304f0afc089f5dde7a45371 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 4 Jan 2017 22:15:01 +0530 Subject: [PATCH 4/9] config.json [apimgt-gateway] renamed to [gatewayEnabled] --- .../windows-web-agent/app/modules/oauth/token-handlers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js index bff0f143f..f18f4c235 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js @@ -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 " + From f3588c7951332bf2470fc67811a07d1d6e6c267d Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 4 Jan 2017 22:28:12 +0530 Subject: [PATCH 5/9] config.json [usernameLength] moved to [userValidationConfig][usernameLength] --- .../jaggeryapps/android-web-agent/api/user-api.jag | 6 +++--- .../jaggeryapps/android-web-agent/app/conf/config.json | 4 +++- .../jaggeryapps/windows-web-agent/api/user-api.jag | 6 +++--- .../jaggeryapps/windows-web-agent/app/conf/config.json | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/api/user-api.jag b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/api/user-api.jag index b038e66ad..2a36433de 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/api/user-api.jag +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/api/user-api.jag @@ -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); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json index 2b5eb8a4f..3c8202705 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/conf/config.json @@ -23,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", diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/api/user-api.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/api/user-api.jag index b038e66ad..2a36433de 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/api/user-api.jag +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/api/user-api.jag @@ -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); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json index 848d467bf..7e4a733cd 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json @@ -23,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", From 0aab12b1b2c8b41fe3454a9dc408243c8f0837b7 Mon Sep 17 00:00:00 2001 From: madhawap Date: Thu, 5 Jan 2017 16:59:04 +0530 Subject: [PATCH 6/9] android sense fixes --- .../carbon/iot/android/sense/util/SenseClientAsyncExecutor.java | 2 +- .../app/src/main/res/layout/activity_register.xml | 2 +- .../app/src/main/res/values/strings.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java index 8a31fdf9c..9289a29a8 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java @@ -116,7 +116,7 @@ public class SenseClientAsyncExecutor extends AsyncTask diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml index 62002d605..e3cf8a1e1 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ WSO2-SenseAgent Sense Settings - Server URL https://host:9443 + Server URL https://host:8243 Speakup to capture the words DeEnroll ActivitySelectSensor From 4fa044357b33eed50f71b63e077f42c67302aa58 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 5 Jan 2017 17:16:31 +0530 Subject: [PATCH 7/9] Replaced [Enterprise Mobility Manager] with [WSO2 IoT Server] --- .../invoke-agent.hbs | 4 ++-- .../pages/mdm.page.enrollments.windows.license/license.hbs | 2 +- .../app/pages/mdm.page.enrollments.windows.login/login.hbs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs index 18375a801..a3af675ca 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs @@ -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.

- 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.
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.license/license.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.license/license.hbs index e51813f42..6d0c5147e 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.license/license.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.license/license.hbs @@ -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 diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.login/login.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.login/login.hbs index 458c63acc..90848f747 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.login/login.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.login/login.hbs @@ -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 }} {{ From 0c7f1adcbae758729935dca4f42156ac8f31850b Mon Sep 17 00:00:00 2001 From: Maninda Date: Thu, 5 Jan 2017 19:36:52 +0530 Subject: [PATCH 8/9] Fixed some issues reported with FindBugs while security plugin is enabled. --- .../communication/http/FireAlarmHTTPCommunicator.java | 2 +- .../pom.xml | 1 + .../plugin/config/VirtualFirealarmConfig.java | 2 ++ .../pom.xml | 1 + .../adapter/websocket/config/WebsocketConfig.java | 5 +++-- .../output/adapter/websocket/util/WebsocketUtils.java | 2 ++ .../android/bean/wrapper/AndroidDeviceInfo.java | 2 +- .../android/common/GsonMessageBodyHandler.java | 8 +------- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 1 + .../android/impl/util/MobileDeviceManagementUtil.java | 2 ++ .../api/common/util/GsonMessageBodyHandler.java | 8 +------- .../windows/api/common/util/WindowsAPIUtils.java | 2 +- .../windows/api/operations/util/OperationHandler.java | 10 +++++----- .../enrollment/impl/EnrollmentServiceImpl.java | 4 +++- .../wstep/impl/CertificateEnrollmentServiceImpl.java | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 1 + .../windows/impl/util/MobileDeviceManagementUtil.java | 2 ++ 17 files changed, 29 insertions(+), 26 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java index 98dbc6dc7..ead68c528 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java @@ -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)) { diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml index 40eba7c2e..8a52af509 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml @@ -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}", diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java index a5a75611e..9bb1380e5 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java @@ -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) { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 6400c6f34..c72d27c77 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -134,6 +134,7 @@ org.wso2.carbon.event.output.adapter.core.*, + javax.xml, javax.xml.namespace; version=0.0.0, org.apache.axis2, org.apache.axis2.client, diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java index 3499cd5e6..64efd5295 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java @@ -75,7 +75,8 @@ public class WebsocketConfig { return websocketValidationConfigs; } - public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) { - websocketValidationConfigs = websocketValidationConfigs; + public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigsTemp) { + websocketValidationConfigs = websocketValidationConfigsTemp; } + } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java index 162bc9955..86e30712f 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java @@ -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) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java index bf775edfe..41fbb5857 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java @@ -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(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java index a1ae89d15..297630029 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java @@ -83,13 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter, 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(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index bad6eab68..e89d77a25 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -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, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java index 3e409653e..210c73502 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java @@ -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) { 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/util/GsonMessageBodyHandler.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/util/GsonMessageBodyHandler.java index ecb720866..683d747cd 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/util/GsonMessageBodyHandler.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/util/GsonMessageBodyHandler.java @@ -82,13 +82,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter, 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(); } 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/util/WindowsAPIUtils.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/util/WindowsAPIUtils.java index 274c7ffae..d77f2a5ab 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/util/WindowsAPIUtils.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/util/WindowsAPIUtils.java @@ -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."); } 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 8b0db0222..52ff4c4e2 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 @@ -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); } } 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 7cd57a495..d59243549 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 @@ -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
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(); 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/wstep/impl/CertificateEnrollmentServiceImpl.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/wstep/impl/CertificateEnrollmentServiceImpl.java index 8e587bfc0..a749214ba 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/wstep/impl/CertificateEnrollmentServiceImpl.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/wstep/impl/CertificateEnrollmentServiceImpl.java @@ -112,7 +112,7 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe String headerTo = null; String encodedWap; List
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(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index 6890f755a..3a74f23de 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -55,6 +55,7 @@ org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, + javax.xml, javax.xml.bind.*, javax.sql, javax.naming, diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java index c658eb6d0..72bf59ef2 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java @@ -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) { From 7dc5a2000dbffa30315256334cade7b9e507893d Mon Sep 17 00:00:00 2001 From: dunithd Date: Thu, 5 Jan 2017 21:23:34 +0530 Subject: [PATCH 9/9] Adding Geo Dashboard link to device view page --- .../device-view.hbs | 16 ++++++++++++++++ .../device-view.js | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs index ba9322aca..ce3f71d7c 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs @@ -73,4 +73,20 @@ + {{/zone}} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js index 32d8c813e..999d4ee64 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js @@ -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!");