From 75ede1a6802cc0ca6d3d220c73af4e0c306fe727 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Sat, 23 Jun 2018 12:58:27 +0530 Subject: [PATCH 1/4] adding app lock policy --- .../public/js/operation-mod.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js index 9cde442948..dbb82d4152 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js @@ -289,6 +289,13 @@ var operationModule = function () { } }; break; + case iosOperationConstants["APP_LOCK_OPERATION_CODE"]: + payload = { + "operation": { + "identifier": operationPayload["identifier"] + } + }; + break; case iosOperationConstants["APPLICATION_OPERATION_CODE"]: payload = { "restrictionType": operationPayload["restriction-type"], @@ -586,6 +593,14 @@ var operationModule = function () { } }; break; + case iosOperationConstants["APP_LOCK_OPERATION_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + payload = { + "operation": { + "identifier": operationData["identifier"] + } + }; + break; case iosOperationConstants["APPLICATION_OPERATION_CODE"]: payload = { "operation": { From aff01cb2ed2f7fc0aa7e4bd35acf98c95b434836 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Sat, 8 Sep 2018 16:54:44 +0530 Subject: [PATCH 2/4] Fixed https://github.com/wso2/product-iots/issues/1864 Logic in handling mutual TLS is change and this leads to enrollment failure in Abdroid --- .../apimgt/handlers/AuthenticationHandler.java | 2 +- .../handlers/AuthenticationHandlerTest.java | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java index b851ee4f8c..6c95b40dee 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java @@ -209,7 +209,7 @@ public boolean handleResponse(org.apache.synapse.MessageContext messageContext) private String getDeviceType(String url) { StringTokenizer parts = new StringTokenizer(url, "/"); while (parts.hasMoreElements()) { - if (parts.nextElement().equals("api")) { + if (parts.nextElement().equals("device-mgt")) { return (String) parts.nextElement(); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java index f42505409a..b3b8cdac78 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java @@ -96,7 +96,7 @@ public void testHandleSuccessfulRequestMDMCertificate() throws Exception { this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); boolean response = this.handler.handleRequest(createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice")); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice")); Assert.assertTrue(response); this.mockClient.reset(); } @@ -110,7 +110,7 @@ public void testHandleSuccessRequestProxyMutualAuthHeader() throws Exception { this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); boolean response = this.handler.handleRequest(createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice")); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice")); Assert.assertTrue(response); this.mockClient.reset(); } @@ -124,7 +124,7 @@ public void testHandleSuccessRequestMutualAuthHeader() throws Exception { this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice"); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); org.apache.axis2.context.MessageContext axisMC = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); String certStr = getContent(TestUtils.getAbsolutePathOfConfig("ra_cert.pem")); X509Certificate cert = X509Certificate.getInstance(new ByteArrayInputStream(certStr. @@ -144,7 +144,7 @@ public void testHandleSuccessRequestEncodedPem() throws Exception { this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice"); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); boolean response = this.handler.handleRequest(messageContext); Assert.assertTrue(response); this.mockClient.reset(); @@ -159,7 +159,7 @@ public void testHandleSuccessRequestEncodedPemInvalidResponse() throws Exception this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getInvalidResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice"); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); boolean response = this.handler.handleRequest(messageContext); Assert.assertFalse(response); this.mockClient.reset(); @@ -173,7 +173,7 @@ public void testHandleRequestWithCertMgmtException() throws Exception { setMockClient(); this.mockClient.setResponse(null); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice"); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); boolean response = this.handler.handleRequest(messageContext); Assert.assertFalse(response); this.mockClient.reset(); @@ -188,7 +188,7 @@ public void testHandleRequestWithIOException() throws Exception { this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(null); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice"); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); boolean response = this.handler.handleRequest(messageContext); Assert.assertFalse(response); this.mockClient.reset(); @@ -202,7 +202,7 @@ public void testHandleRequestWithURIException() throws Exception { transportHeaders.put(AuthConstants.MDM_SIGNATURE, "some cert"); AuthenticationHandler handler = new AuthenticationHandler(); boolean response = handler.handleRequest(createSynapseMessageContext("", this.synapseConfiguration, - transportHeaders, "https://test.com/testservice/api/testdevice")); + transportHeaders, "https://test.com/testservice/device-mgt/testdevice")); Assert.assertFalse(response); TestUtils.setSystemProperties(); } From eb7e6e5f48d8458861aaf6a6ae8e07dfcb962613 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Sat, 8 Sep 2018 17:14:21 +0530 Subject: [PATCH 3/4] Revert "adding app lock policy" This reverts commit 75ede1a6802cc0ca6d3d220c73af4e0c306fe727. --- .../public/js/operation-mod.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js index dbb82d4152..9cde442948 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js @@ -289,13 +289,6 @@ var operationModule = function () { } }; break; - case iosOperationConstants["APP_LOCK_OPERATION_CODE"]: - payload = { - "operation": { - "identifier": operationPayload["identifier"] - } - }; - break; case iosOperationConstants["APPLICATION_OPERATION_CODE"]: payload = { "restrictionType": operationPayload["restriction-type"], @@ -593,14 +586,6 @@ var operationModule = function () { } }; break; - case iosOperationConstants["APP_LOCK_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "identifier": operationData["identifier"] - } - }; - break; case iosOperationConstants["APPLICATION_OPERATION_CODE"]: payload = { "operation": { From 7fa8054c4389c6a6a18f1677a3587327afde5f91 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 16 Nov 2018 17:29:26 +0530 Subject: [PATCH 4/4] fixing https://github.com/wso2/product-iots/issues/1892 --- .../java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java index 2114a2e206..f6eb7d0654 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java @@ -117,7 +117,7 @@ public boolean equals(Object obj) { if (obj instanceof EnrolmentInfo) { EnrolmentInfo tempInfo = (EnrolmentInfo) obj; if (this.owner != null && this.ownership != null) { - if (this.owner.equalsIgnoreCase(tempInfo.getOwner()) && this.ownership.equals(tempInfo.getOwnership())) { + if (this.owner.equalsIgnoreCase(tempInfo.getOwner())) { return true; } }