diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 8f5387b87b..1f726c3f2b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 3d0f46b92b..ba6b5e6e75 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 496deb894a..007807a25a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index 58ee9e50cd..503b3c4d9e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module 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..8bad3de1a8 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 @@ -94,11 +94,7 @@ public class AuthenticationHandler extends AbstractHandler { if (log.isDebugEnabled()) { log.debug("Verify Cert:\n" + mdmSignature); } - String deviceType = this.getDeviceType(messageContext.getTo().getAddress().trim()); - if (deviceType == null) { - return false; - } - URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + deviceType); + URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + "ios"); Map certVerifyHeaders = this.setHeaders(this.restInvoker); Certificate certificate = new Certificate(); @@ -209,7 +205,7 @@ public class AuthenticationHandler extends AbstractHandler { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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 class AuthenticationHandlerTest extends BaseAPIHandlerTest { 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(); } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index 1241c92d33..2c35fa03a8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 02bd1656b9..d45ff5ca1a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index 0c30bf4f4a..f2d741b79d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 374ddfdad7..ecaebeea11 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml index 5f5953e40e..83a6ffb393 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.addons/pom.xml @@ -5,12 +5,12 @@ application-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT 4.0.0 org.wso2.carbon.device.application.mgt.addons - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT WSO2 Carbon - Application Management Add-Ons WSO2 Carbon - Application Management Add-Ons http://wso2.org diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml index 07700d3724..d2d10b4341 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml @@ -22,13 +22,13 @@ application-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.api - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management API WSO2 Carbon - Application Management API diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml index ed8caefa30..976bbb84c7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.common - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - Application Management Common WSO2 Carbon - Application Management Common diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml index e958238813..f65c0b0c5d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.core - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - Application Management Core WSO2 Carbon - Application Management Core diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.handler/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.handler/pom.xml index 2f9af3295c..8a8fe15e6c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.handler/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.handler/pom.xml @@ -24,11 +24,11 @@ org.wso2.carbon.devicemgt application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT org.wso2.carbon.device.application.mgt.handler - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management Authentication Handler API Proxy Service for Authentication Handling in WSO2 App Manager. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml index 1bcab21635..cabaa138d5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/pom.xml @@ -22,13 +22,13 @@ application-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.publisher.api - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management Publisher API WSO2 Carbon - Application Management Publisher API diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml index 57a2552cd2..4f0db31d01 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml @@ -24,10 +24,10 @@ org.wso2.carbon.devicemgt application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT org.wso2.carbon.device.application.mgt.publisher.ui - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management Publisher UI Component http://wso2.org diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml index 8a97ddeed3..ae5daccb49 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/pom.xml @@ -22,13 +22,13 @@ application-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.application.mgt.store.api - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management Store API WSO2 Carbon - Application Management Store API diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/pom.xml index 69a28b7169..1ca50ca6d3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/pom.xml @@ -24,10 +24,10 @@ org.wso2.carbon.devicemgt application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT org.wso2.carbon.device.application.mgt.store.ui - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT war WSO2 Carbon - Application Management Store UI Component http://wso2.org diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 23ec81127c..c951d59e98 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../../pom.xml 4.0.0 application-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT pom WSO2 Carbon - Application Management Component WSO2 Carbon - Application Management Component diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index 8ff3e69df7..5d20540954 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index b52ac7a4bc..6372b84372 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml deleted file mode 100644 index 422efd5f0b..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - certificate-mgt - org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.certificate.mgt.cert.admin.v09.api - war - WSO2 Carbon - Admin Certificate Management v09 API - WSO2 Carbon - Admin Certificate Management v09 API - http://wso2.org - - - - - maven-compiler-plugin - - 1.8 - 1.8 - - - - maven-war-plugin - - WEB-INF/lib/*cxf*.jar - api#certificate-mgt#v0.9 - - - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - - - - - deploy - - compile - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - compile - - run - - - - - - - - - - - - - - - - - - client - - test - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - test - - java - - - - - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - - - commons-codec.wso2 - commons-codec - - - commons-codec - commons-codec - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - cxf-rt-transports-http - - - junit - junit - test - - - javax.ws.rs - jsr311-api - provided - - - org.wso2.carbon - org.wso2.carbon.logging - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.jwt.client.extension - provided - - - io.swagger - swagger-annotations - - - io.swagger - swagger-core - - - org.slf4j - slf4j-api - - - - - io.swagger - swagger-jaxrs - - - org.slf4j - slf4j-api - - - - - javax.servlet - javax.servlet-api - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.annotations - provided - - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java deleted file mode 100644 index 9e56e2645a..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * / - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; - -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificate; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; -import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; - -import javax.validation.constraints.Size; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -@SwaggerDefinition( - info = @Info( - version = "0.9.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "Certificate Management"), - @ExtensionProperty(name = "context", value = "/api/certificate-mgt/v0.9/admin/certificates"), - }) - } - ), - tags = { - @Tag(name = "device_management", description = "") - } -) -@Api(value = "Certificate Management", description = "This API includes all the certificate management related operations") -@Path("/admin/certificates") -@Scopes(scopes = { - @Scope( - name = "Adding a new SSL certificate", - description = "Adding a new SSL certificate", - key = "perm:admin:certificates:add", - permissions = {"/device-mgt/admin/certificates/add"} - ), - @Scope( - name = "Getting Details of an SSL Certificate", - description = "Getting Details of an SSL Certificate", - key = "perm:admin:certificates:details", - permissions = {"/device-mgt/admin/certificates/details"} - ), - @Scope( - name = "Getting Details of Certificates", - description = "Getting Details of Certificates", - key = "perm:admin:certificates:view", - permissions = {"/device-mgt/admin/certificates/view"} - ), - @Scope( - name = "Deleting an SSL Certificate", - description = "Deleting an SSL Certificate", - key = "perm:admin:certificates:delete", - permissions = {"/device-mgt/admin/certificates/delete"} - ), - @Scope( - name = "Verify SSL certificate", - description = "Verify SSL certificate", - key = "perm:admin:certificates:verify", - permissions = {"/device-mgt/admin/certificates/verify"} - ) -} -) -@Produces(MediaType.APPLICATION_JSON) -@Consumes(MediaType.APPLICATION_JSON) -public interface CertificateManagementAdminService { - - String SCOPE = "scope"; - - /** - * Save a list of certificates and relevant information in the database. - * - * @param enrollmentCertificates List of all the certificates which includes the tenant id, certificate as - * a pem and a serial number. - * @return Status of the data persist operation. - */ - @POST - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Adding a new SSL certificate", - notes = "Add a new SSL certificate to the client end database.\n", - tags = "Certificate Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:add") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully added the certificate.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The URL of the added certificates."), - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class), - @ApiResponse( - code = 415, - message = "Unsupported Media Type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while adding certificates.", - response = ErrorResponse.class) - }) - Response addCertificate( - @ApiParam( - name = "enrollmentCertificates", - value = "The properties to add a new certificate. It includes the following: \n" + - "serial: The unique ID of the certificate. \n" + - "pem: Convert the OpenSSL certificate to the .pem format and base 64 encode the file. \n" + - "INFO: Upload the .pem file and base 64 encode it using a tool, such as the base64encode.in tool.", - required = true) EnrollmentCertificate[] enrollmentCertificates); - - /** - * Get a certificate when the serial number is given. - * - * @param serialNumber serial of the certificate needed. - * @return certificate response. - */ - @GET - @Path("/{serialNumber}") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting Details of an SSL Certificate", - notes = "Get the client side SSL certificate details.", - tags = "Certificate Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:details") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the certificate details.", - response = CertificateResponse.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - }), - @ApiResponse( - code = 304, - message = "Not Modified. \n " + - "Empty body because the client already has the latest version of the requested resource."), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class), - @ApiResponse( - code = 404, - message = "Not Found. \n The specified certificate does not exist."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while retrieving the requested certificate information.", - response = ErrorResponse.class) - }) - Response getCertificate( - @ApiParam(name = "serialNumber", - value = "The serial number of the certificate.", - required = true, - defaultValue = "124380353155528759302") - @PathParam("serialNumber") String serialNumber, - @ApiParam( - name = "If-Modified-Since", - value = "Checks if the requested variant was modified, since the specified date-time.\n" + - "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince - ); - - /** - * Get all certificates in a paginated manner. - * - * @return paginated result of certificate. - */ - @GET - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting Details of Certificates", - notes = "Get all the details of the certificates you have used for mutual SSL. In a situation where you wish to " - + "view all the certificate details, it is not feasible to show all the details on one " - + "page. Therefore, the details are paginated.", - tags = "Certificate Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:view") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the list of certificates.", - response = CertificateList.class, - responseContainer = "List", - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n " + - "The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 304, - message = "Not Modified. \n " + - "Empty body because the client already has the latest version of the requested resource."), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class), - @ApiResponse( - code = 406, - message = "Not Acceptable. \n The requested media type is not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while retrieving the certificate details.", - response = ErrorResponse.class) - }) - Response getAllCertificates( - @ApiParam( - name = "offset", - value = "The starting pagination index for the complete list of qualified items.", - required = false, - defaultValue = "0") - @QueryParam("offset") int offset, - @ApiParam( - name = "limit", - value = "Provide how many certificate details you require from the starting pagination index/offset.", - required = false, - defaultValue = "5") - @QueryParam("limit") int limit, - @ApiParam( - name = "If-Modified-Since", - value = "Checks if the requested variant was modified, since the specified date-time. \n" + - "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince); - - @DELETE - @Path("/{serialNumber}") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "DELETE", - value = "Deleting an SSL Certificate", - notes = "Delete an SSL certificate that's on the client end.", - tags = "Certificate Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:delete") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully removed the certificate."), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class), - @ApiResponse( - code = 404, - message = "Not Found. \n The specified resource does not exist."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while removing the certificate.", - response = ErrorResponse.class)}) - Response removeCertificate( - @ApiParam( - name = "serialNumber", - value = "The serial number of the certificate.\n" + - "NOTE: Make sure that a certificate with the serial number you provide exists in the server. If not, first add a certificate.", - required = true, - defaultValue = "12438035315552875930") - @PathParam("serialNumber") String serialNumber); - - /** - * Verify Certificate for the API security filter - * - * @param certificate to be verified as a String - * @return Status of the certificate verification. - */ - @POST - @Path("/verify/{type}") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Verify SSL certificate", - notes = "Verify Certificate for the API security filter.\n", - tags = "Certificate Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:verify") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "Return the status of the certificate verification.", - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class) - }) - Response verifyCertificate( - @ApiParam( - name = "type", - value = "The device type, such as ios, android or windows.", - required = true, - allowableValues = "android, ios, windows") - @PathParam("type") - @Size(max = 45) - String type, - @ApiParam( - name = "certificate", - value = "The properties to verify certificate. It includes the following: \n" + - "serial: The unique ID of the certificate. (optional) \n" + - "pem: pem String of the certificate", - required = true) EnrollmentCertificate certificate); -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/InputValidationException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/InputValidationException.java deleted file mode 100644 index e7bf9a2b84..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/InputValidationException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; - -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.io.Serializable; - -public class InputValidationException extends WebApplicationException implements Serializable { - - private static final long serialVersionUID = 147843589458906890L; - - public InputValidationException(ErrorResponse error) { - super(Response.status(Response.Status.BAD_REQUEST).entity(error).build()); - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/UnexpectedServerErrorException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/UnexpectedServerErrorException.java deleted file mode 100644 index 8a422bb8d4..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/UnexpectedServerErrorException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; - -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class UnexpectedServerErrorException extends WebApplicationException { - - private static final long serialVersionUID = 147943679458906890L; - - public UnexpectedServerErrorException(ErrorResponse error) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/BasePaginatedResult.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/BasePaginatedResult.java deleted file mode 100644 index dd3799e3ef..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/BasePaginatedResult.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - -public class BasePaginatedResult { - - private int count; - private String next; - private String previous; - - /** - * Number of Devices returned. - */ - @ApiModelProperty(value = "Number of resources returned.") - @JsonProperty("count") - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - - /** - * Link to the next subset of resources qualified. \nEmpty if no more resources are to be returned. - */ - @ApiModelProperty(value = "Link to the next subset of resources qualified. \n " + - "Empty if no more resources are to be returned.") - @JsonProperty("next") - public String getNext() { - return next; - } - - public void setNext(String next) { - this.next = next; - } - - /** - * Link to the previous subset of resources qualified. \nEmpty if current subset is the first subset returned. - */ - @ApiModelProperty(value = "Link to the previous subset of resources qualified. \n" + - "Empty if current subset is the first subset returned.") - @JsonProperty("previous") - public String getPrevious() { - return previous; - } - - public void setPrevious(String previous) { - this.previous = previous; - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/CertificateList.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/CertificateList.java deleted file mode 100644 index 08b998e3dc..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/CertificateList.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; - -import java.util.ArrayList; -import java.util.List; - -public class CertificateList extends BasePaginatedResult { - - private List certificates = new ArrayList<>(); - - @ApiModelProperty(value = "List of certificates returned") - @JsonProperty("certificates") - public List getList() { - return certificates; - } - - public void setList(List certificates) { - this.certificates = certificates; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{\n"); - sb.append(" count: ").append(getCount()).append(",\n"); - sb.append(" next: ").append(getNext()).append(",\n"); - sb.append(" previous: ").append(getPrevious()).append(",\n"); - sb.append(" certificates: [").append(certificates).append("\n"); - sb.append("]}\n"); - return sb.toString(); - } -} - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/EnrollmentCertificate.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/EnrollmentCertificate.java deleted file mode 100644 index cb624f0445..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/EnrollmentCertificate.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -public class EnrollmentCertificate { - String serial; - String pem; - int tenantId; - - public int getTenantId() { - return tenantId; - } - - public void setTenantId(int tenantId) { - this.tenantId = tenantId; - } - - public String getSerial() { - return serial; - } - - public void setSerial(String serial) { - this.serial = serial; - } - - public String getPem() { - return pem; - } - - public void setPem(String pem) { - this.pem = pem; - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorListItem.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorListItem.java deleted file mode 100644 index d7b793ac9f..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorListItem.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.NotNull; - -@ApiModel(description = "Error List Item") -public class ErrorListItem { - - @NotNull - private String code = null; - @NotNull - private String message = null; - - @ApiModelProperty(required = true, value = "") - @JsonProperty("code") - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public ErrorListItem() { - } - - public ErrorListItem(String code, String msg) { - this.code = code; - this.message = msg; - } - - - /** - * Description about individual errors occurred - */ - @ApiModelProperty(required = true, value = "Description about individual errors occurred") - @JsonProperty("message") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("errorItem {\n"); - - sb.append(" code: ").append(code).append("\n"); - sb.append(" message: ").append(message).append("\n"); - sb.append("}\n"); - return sb.toString(); - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorResponse.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorResponse.java deleted file mode 100644 index fc7147324f..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ErrorResponse.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.ArrayList; -import java.util.List; - -@ApiModel(description = "Error Response") -public class ErrorResponse { - - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List errorItems = new ArrayList<>(); - - private ErrorResponse() { - } - - @JsonProperty(value = "code") - @ApiModelProperty(required = true, value = "") - public Long getCode() { - return code; - } - - public void setCode(Long code) { - this.code = code; - } - - @JsonProperty(value = "message") - @ApiModelProperty(required = true, value = "ErrorResponse message.") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @JsonProperty(value = "description") - @ApiModelProperty(value = "A detail description about the error message.") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty(value = "moreInfo") - @ApiModelProperty(value = "Preferably an url with more details about the error.") - public String getMoreInfo() { - return moreInfo; - } - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void addErrorListItem(ErrorListItem item) { - this.errorItems.add(item); - } - - /** - * If there are more than one error list them out. \nFor example, list out validation errors by each field. - */ - @JsonProperty(value = "errorItems") - @ApiModelProperty(value = "If there are more than one error list them out. \n" + - "For example, list out validation errors by each field.") - public List getErrorItems() { - return errorItems; - } - - public void setErrorItems(List error) { - this.errorItems = error; - } - - @Override - public String toString() { -// StringBuilder sb = new StringBuilder(); -// sb.append("{"); -// boolean cont = false; -// if (code != null) { -// cont = true; -// sb.append(" \"code\": ").append(code); -// } -// if (message != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"message\": \"").append(message).append("\""); -// } -// if (description != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"description\": ").append(description).append("\""); -// } -// if (moreInfo != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\""); -// } -// if (error != null && error.size() > 0) { -// if (cont) { -// sb.append(","); -// } -// sb.append(" \"errorItems\": ").append(error); -// } -// sb.append("}"); -// return sb.toString(); - return null; - } - - public static class ErrorResponseBuilder { - - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List error; - - - public ErrorResponseBuilder() { - this.error = new ArrayList<>(); - } - - public ErrorResponseBuilder setCode(long code) { - this.code = code; - return this; - } - - public ErrorResponseBuilder setMessage(String message) { - this.message = message; - return this; - } - - public ErrorResponseBuilder setDescription(String description) { - this.description = description; - return this; - } - - public ErrorResponseBuilder setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - return this; - } - - public ErrorResponseBuilder addErrorItem(String code, String msg) { - ErrorListItem item = new ErrorListItem(); - item.setCode(code); - item.setMessage(msg); - this.error.add(item); - return this; - } - - public ErrorResponse build() { - ErrorResponse errorResponse = new ErrorResponse(); - errorResponse.setCode(code); - errorResponse.setMessage(message); - errorResponse.setErrorItems(error); - errorResponse.setDescription(description); - errorResponse.setMoreInfo(moreInfo); - return errorResponse; - } - } - -} - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponse.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponse.java deleted file mode 100644 index b4fa074734..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponse.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; - -public class ValidationResponse { - - private String JWTToken; // X-JWT-Assertion - private String deviceId; - private String deviceType; - private int tenantId; - - public String getJWTToken() { - return JWTToken; - } - - public void setJWTToken(String JWTToken) { - this.JWTToken = JWTToken; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getDeviceType() { - return deviceType; - } - - public void setDeviceType(String deviceType) { - this.deviceType = deviceType; - } - - public int getTenantId() { - return tenantId; - } - - public void setTenantId(int tenantId) { - this.tenantId = tenantId; - } -} - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorHandler.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorHandler.java deleted file mode 100644 index ffd02762d3..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.common; - -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; - -@Produces({ "application/json", "application/xml" }) -public class ErrorHandler implements ExceptionMapper { - - public Response toResponse(MDMAPIException exception) { - ErrorMessage errorMessage = new ErrorMessage(); - errorMessage.setErrorMessage(exception.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorMessage.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorMessage.java deleted file mode 100644 index 838e9f4d21..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/ErrorMessage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.common; - - -public class ErrorMessage { - - private String errorMessage; - private String errorCode; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/GsonMessageBodyHandler.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/GsonMessageBodyHandler.java deleted file mode 100644 index 6fed8add67..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/GsonMessageBodyHandler.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.common; - - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import java.io.*; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -@Provider -@Produces(APPLICATION_JSON) -@Consumes(APPLICATION_JSON) -public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { - - private Gson gson; - private static final String UTF_8 = "UTF-8"; - - public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - private Gson getGson() { - if (gson == null) { - final GsonBuilder gsonBuilder = new GsonBuilder(); - gson = gsonBuilder.create(); - } - return gson; - } - - public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) - throws IOException, WebApplicationException { - - InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8"); - - try { - return getGson().fromJson(reader, type); - } finally { - reader.close(); - } - } - - public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return -1; - } - - public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) - throws IOException, WebApplicationException { - - OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); - try { - getGson().toJson(object, type, writer); - } finally { - writer.close(); - } - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/MDMAPIException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/MDMAPIException.java deleted file mode 100644 index 8e1591a605..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/common/MDMAPIException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.common; - -/** - * Custom exception class for handling CDM API related exceptions. - */ -public class MDMAPIException extends Exception { - - private static final long serialVersionUID = 7950151650447893900L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public MDMAPIException(String msg, Exception e) { - super(msg, e); - setErrorMessage(msg); - } - - public MDMAPIException(String msg, Throwable cause) { - super(msg, cause); - setErrorMessage(msg); - } - - public MDMAPIException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public MDMAPIException() { - super(); - } - - public MDMAPIException(Throwable cause) { - super(cause); - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/BadRequestException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/BadRequestException.java deleted file mode 100644 index 49221cc08f..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/BadRequestException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.exception; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -public class BadRequestException extends WebApplicationException { - - public BadRequestException(Message message, MediaType mediaType) { - super(Response.status(Response.Status.BAD_REQUEST).entity(message).type(mediaType).build()); - } - -} \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/Message.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/Message.java deleted file mode 100644 index dd0369bb79..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/exception/Message.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.exception; - -public class Message { - - private String errorMessage; - private String discription; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getDiscription() { - return discription; - } - - public void setDiscription(String discription) { - this.discription = discription; - } -} \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java deleted file mode 100644 index 6ce9bdd842..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2016-2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.CertificateManagementAdminService; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificate; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ValidationResponse; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.CertificateMgtAPIUtils; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.RequestValidationUtil; -import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; -import org.wso2.carbon.certificate.mgt.core.exception.CertificateManagementException; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.scep.SCEPException; -import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; -import org.wso2.carbon.certificate.mgt.core.scep.TenantedDeviceWrapper; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.certificate.mgt.core.service.PaginationResult; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Path("/admin/certificates") -public class CertificateManagementAdminServiceImpl implements CertificateManagementAdminService { - - private static Log log = LogFactory.getLog(CertificateManagementAdminServiceImpl.class); - private static final String PROXY_AUTH_MUTUAL_HEADER = "proxy-mutual-auth-header"; - - /** - * Save a list of certificates and relevant information in the database. - * - * @param enrollmentCertificates List of all the certificates which includes the tenant id, certificate as - * a pem and a serial number. - * @return Status of the data persist operation. - */ - @POST - public Response addCertificate(EnrollmentCertificate[] enrollmentCertificates) { - CertificateManagementService certificateService; - List certificates = new ArrayList<>(); - org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate; - certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); - try { - for (EnrollmentCertificate enrollmentCertificate : enrollmentCertificates) { - certificate = new org.wso2.carbon.certificate.mgt.core.bean.Certificate(); - certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); - certificate.setSerial(enrollmentCertificate.getSerial()); - certificate.setCertificate(certificateService.pemToX509Certificate(enrollmentCertificate.getPem())); - certificates.add(certificate); - } - certificateService.saveCertificate(certificates); - return Response.status(Response.Status.CREATED).entity("Added successfully.").build(); - } catch (KeystoreException e) { - String msg = "Error occurred while converting PEM file to X509Certificate."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } - } - - /** - * Get a certificate when the serial number is given. - * - * @param serialNumber serial of the certificate needed. - * @return certificate response. - */ - @GET - @Path("/{serialNumber}") - public Response getCertificate( - @PathParam("serialNumber") String serialNumber, - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - RequestValidationUtil.validateSerialNumber(serialNumber); - - CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); - List certificateResponse; - try { - certificateResponse = certificateService.searchCertificates(serialNumber); - return Response.status(Response.Status.OK).entity(certificateResponse).build(); - } catch (CertificateManagementException e) { - String msg = "Error occurred while converting PEM file to X509Certificate"; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } - } - - /** - * Get all certificates in a paginated manner. - * - * @param offset index of the first record to be fetched - * @param limit number of records to be fetched starting from the start index. - * @return paginated result of certificate. - */ - @GET - public Response getAllCertificates( - @QueryParam("offset") int offset, - @QueryParam("limit") int limit, - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - RequestValidationUtil.validatePaginationInfo(offset, limit); - CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); - try { - PaginationResult result = certificateService.getAllCertificates(offset, limit); - CertificateList certificates = new CertificateList(); - certificates.setCount(result.getRecordsTotal()); - certificates.setList((List) result.getData()); - return Response.status(Response.Status.OK).entity(certificates).build(); - } catch (CertificateManagementException e) { - String msg = "Error occurred while fetching all certificates."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } - } - - @DELETE - @Deprecated - @Path("/{serialNumber}") - public Response removeCertificate(@PathParam("serialNumber") String serialNumber) { - RequestValidationUtil.validateSerialNumber(serialNumber); - - CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService(); - try { - certificateService.removeCertificate(serialNumber); - return Response.status(Response.Status.OK).entity( - "Certificate that carries the serial number '" + - serialNumber + "' has been removed").build(); - } catch (CertificateManagementException e) { - String msg = "Error occurred while converting PEM file to X509Certificate"; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } - } - -// @POST -// @Path("/verify/ios") -// public Response verifyIOSCertificate(@ApiParam(name = "certificate", value = "Mdm-Signature of the " + -// "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { -// try { -// CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); -// X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); -// String challengeToken = certMgtService.extractChallengeToken(cert); -// -// if (challengeToken != null) { -// challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); -// -// SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); -// DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); -// deviceIdentifier.setId(challengeToken); -// deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); -// TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); -// -// if (tenantedDeviceWrapper != null) { -// return Response.status(Response.Status.OK).entity("valid").build(); -// } -// } -// } catch (SCEPException e) { -// String msg = "Error occurred while extracting information from certificate."; -// log.error(msg, e); -// return Response.serverError().entity( -// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); -// } catch (KeystoreException e) { -// String msg = "Error occurred while converting PEM file to X509Certificate."; -// log.error(msg, e); -// return Response.serverError().entity( -// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); -// } -// return Response.status(Response.Status.OK).entity("invalid").build(); -// } -// -// @POST -// @Path("/verify/android") -// public Response verifyAndroidCertificate(@ApiParam(name = "certificate", value = "Base64 encoded .pem file of the " + -// "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { -// CertificateResponse certificateResponse = null; -// try { -// CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); -// if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { -// certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); -// } else { -// X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); -// if (clientCertificate != null) { -// certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); -// } -// } -// -// if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse -// .getCommonName().isEmpty()) { -// return Response.status(Response.Status.OK).entity("valid").build(); -// } -// } catch (KeystoreException e) { -// String msg = "Error occurred while converting PEM file to X509Certificate."; -// log.error(msg, e); -// return Response.serverError().entity( -// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); -// } -// return Response.status(Response.Status.OK).entity("invalid").build(); -// } - - @POST - @Path("/verify/{type}") - public Response verifyCertificate(@PathParam("type") String type, EnrollmentCertificate certificate) { - try { - CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); - - if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equalsIgnoreCase(type)) { - X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); - String challengeToken = certMgtService.extractChallengeToken(cert); - - if (challengeToken != null) { - challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); - - SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(challengeToken); - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); - TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); - - Map claims = new HashMap<>(); - - claims.put("http://wso2.org/claims/enduserTenantId", - String.valueOf(tenantedDeviceWrapper.getTenantId())); - claims.put("http://wso2.org/claims/enduser", - tenantedDeviceWrapper.getDevice().getEnrolmentInfo().getOwner() + "@" - + tenantedDeviceWrapper.getTenantDomain()); - claims.put("http://wso2.org/claims/deviceIdentifier", - tenantedDeviceWrapper.getDevice().getDeviceIdentifier()); - claims.put("http://wso2.org/claims/deviceIdType", tenantedDeviceWrapper.getDevice().getType()); - - String jwdToken; - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext() - .setTenantId(tenantedDeviceWrapper.getTenantId()); - PrivilegedCarbonContext.getThreadLocalCarbonContext() - .setTenantDomain(tenantedDeviceWrapper.getTenantDomain()); - JWTClientManagerService jwtClientManagerService = CertificateMgtAPIUtils - .getJwtClientManagerService(); - jwdToken = jwtClientManagerService.getJWTClient() - .getJwtToken(tenantedDeviceWrapper.getDevice().getEnrolmentInfo().getOwner(), claims, - true); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - - ValidationResponse validationResponse = new ValidationResponse(); - validationResponse.setDeviceId(challengeToken); - validationResponse.setDeviceType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); - validationResponse.setJWTToken(jwdToken); - validationResponse.setTenantId(tenantedDeviceWrapper.getTenantId()); - - return Response.status(Response.Status.OK).entity(validationResponse).build(); - } - } - - if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equalsIgnoreCase(type)) { - CertificateResponse certificateResponse = null; - if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { - certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); - } else { - X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); - if (clientCertificate != null) { - certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); - } - } - - if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse - .getCommonName().isEmpty()) { - return Response.status(Response.Status.OK).entity("valid").build(); - } - } - } catch (SCEPException e) { - String msg = "Error occurred while extracting information from certificate."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } catch (KeystoreException e) { - String msg = "Error occurred while converting PEM file to X509Certificate."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } catch (JWTClientException e) { - String msg = "Error occurred while converting PEM file to X509Certificate."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } - return Response.status(Response.Status.OK).entity("invalid").build(); - } -} \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/swagger/extension/SecurityDefinitionConfigurator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/swagger/extension/SecurityDefinitionConfigurator.java deleted file mode 100644 index 5fd44e602f..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/swagger/extension/SecurityDefinitionConfigurator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * / - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.swagger.extension; - -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.jaxrs.Reader; -import io.swagger.jaxrs.config.ReaderListener; -import io.swagger.models.Swagger; -import io.swagger.models.auth.OAuth2Definition; -import io.swagger.models.auth.SecuritySchemeDefinition; - -import java.util.HashMap; -import java.util.Map; - -@SwaggerDefinition( - basePath = "/api/certificate-mgt/v0.9", - host = "localhost:9443" -) -public class SecurityDefinitionConfigurator implements ReaderListener { - - public static final String TOKEN_AUTH_SCHEME = "swagger_auth"; - - @Override - public void beforeScan(Reader reader, Swagger swagger) { - - } - - @Override - public void afterScan(Reader reader, Swagger swagger) { - OAuth2Definition tokenScheme = new OAuth2Definition(); - tokenScheme.setType("oauth2"); - tokenScheme.setFlow("application"); - tokenScheme.setTokenUrl("https://" + swagger.getHost() + "/oauth2/token"); - tokenScheme.setAuthorizationUrl("https://" + swagger.getHost() + "/oauth2/authorize"); - tokenScheme.addScope("write:everything", "Full access"); - - Map schemes = new HashMap<>(); - schemes.put(TOKEN_AUTH_SCHEME, tokenScheme); - - swagger.setSecurityDefinitions(schemes); - } - -} - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ApiOriginFilter.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ApiOriginFilter.java deleted file mode 100644 index 34816863f9..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ApiOriginFilter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class ApiOriginFilter implements Filter { - - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - public void destroy() { - //do nothing - } - - public void init(FilterConfig filterConfig) throws ServletException { - //do nothing - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java deleted file mode 100644 index 071db4884c..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; - -import javax.ws.rs.core.MediaType; - -/** - * CertificateMgtAPIUtils class provides utility functions used by Certificate Mgt REST-API classes. - */ -public class CertificateMgtAPIUtils { - - public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.APPLICATION_JSON_TYPE; - private static Log log = LogFactory.getLog(CertificateMgtAPIUtils.class); - - public static CertificateManagementService getCertificateManagementService() { - - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - CertificateManagementService certificateManagementService = (CertificateManagementService) - ctx.getOSGiService(CertificateManagementService.class, null); - - if (certificateManagementService == null) { - String msg = "CertificateManagementAdminServiceImpl Management service not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - - return certificateManagementService; - } - - - public static JWTClientManagerService getJwtClientManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - JWTClientManagerService jwtClientManagerService = (JWTClientManagerService) - ctx.getOSGiService(JWTClientManagerService.class, null); - - if (jwtClientManagerService == null) { - String msg = "JWTClientManagerService Management service not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - - return jwtClientManagerService; - } - - - public static SCEPManager getSCEPManagerService() { - - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - SCEPManager scepManagerService = (SCEPManager) - ctx.getOSGiService(SCEPManager.class, null); - - if (scepManagerService == null) { - String msg = "SCEPManagerImpl Management service not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - - return scepManagerService; - } - - - public static MediaType getResponseMediaType(String acceptHeader) { - MediaType responseMediaType; - if (acceptHeader == null || MediaType.WILDCARD.equals(acceptHeader)) { - responseMediaType = DEFAULT_CONTENT_TYPE; - } else { - responseMediaType = MediaType.valueOf(acceptHeader); - } - - return responseMediaType; - } - - public static SearchManagerService getSearchManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - SearchManagerService searchManagerService = - (SearchManagerService) ctx.getOSGiService(SearchManagerService.class, null); - if (searchManagerService == null) { - String msg = "DeviceImpl search manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return searchManagerService; - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/RequestValidationUtil.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/RequestValidationUtil.java deleted file mode 100644 index ba6da27b96..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/RequestValidationUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util; - -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; -import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.InputValidationException; - -public class RequestValidationUtil { - - public static void validateSerialNumber(String serialNumber) { - if (serialNumber == null || serialNumber.isEmpty()) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Serial number cannot be null or empty").build()); - } - } - - public static void validatePaginationInfo(int offset, int limit) { - if (offset < 0) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Offset number cannot be negative").build()); - } - if (limit < 0) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Limit number cannot be negative").build()); - } - } - - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ResponsePayload.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ResponsePayload.java deleted file mode 100644 index fa01d2de08..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/ResponsePayload.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class ResponsePayload { - - private int statusCode; - private String messageFromServer; - private Object responseContent; - - @XmlElement - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - @XmlElement - public String getMessageFromServer() { - return messageFromServer; - } - - public void setMessageFromServer(String messageFromServer) { - this.messageFromServer = messageFromServer; - } - - @XmlElement - public Object getResponseContent() { - return responseContent; - } - - public void setResponseContent(Object responseContent) { - this.responseContent = responseContent; - } - - private ResponsePayloadBuilder getBuilder() { - return new ResponsePayloadBuilder(); - } - - public static ResponsePayloadBuilder statusCode(int statusCode) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().statusCode(statusCode); - } - - public static ResponsePayloadBuilder messageFromServer(String messageFromServer) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().messageFromServer(messageFromServer); - } - - public static ResponsePayloadBuilder responseContent(String responseContent) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().responseContent(responseContent); - } - - public class ResponsePayloadBuilder { - - private int statusCode; - private String messageFromServer; - private Object responseContent; - - public ResponsePayloadBuilder statusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - public ResponsePayloadBuilder messageFromServer(String messageFromServer) { - this.messageFromServer = messageFromServer; - return this; - } - - public ResponsePayloadBuilder responseContent(String responseContent) { - this.responseContent = responseContent; - return this; - } - - public ResponsePayload build() { - ResponsePayload payload = new ResponsePayload(); - payload.setStatusCode(statusCode); - payload.setMessageFromServer(messageFromServer); - payload.setResponseContent(responseContent); - return payload; - } - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/permissions.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/permissions.xml deleted file mode 100644 index 99a0db20a2..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/permissions.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - View all certificates - /device-mgt/admin/certificate/GetAll - /admin/certificates - GET - - - Add certificate - /device-mgt/admin/certificate/Add - /admin/certificates - POST - - - Remove certificate - /device-mgt/admin/certificate/Remove - /admin/certificates/* - DELETE - - - View certificate - /device-mgt/admin/certificate/View - /admin/certificates/* - GET - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index 8ec4d9fa45..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index 43265c60c8..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 64908014e5..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - Certificate-Webapp - - JAX-WS/JAX-RS Certificate Management Endpoint - JAX-WS/JAX-RS Servlet - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - - swagger.security.filter - ApiAuthorizationFilterImpl - - 1 - - - CXFServlet - /* - - - 60 - - - doAuthentication - true - - - isDefault - false - - - - - managed-api-enabled - true - - - managed-api-owner - admin - - - isSharedWithAllTenants - true - - - - - CertificateMgt-Admin - /* - - - CONFIDENTIAL - - - - - ApiOriginFilter - org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.ApiOriginFilter - - - - HttpHeaderSecurityFilter - org.apache.catalina.filters.HttpHeaderSecurityFilter - - hstsEnabled - false - - - - - ContentTypeBasedCachePreventionFilter - org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter - - patterns - text/html" ,application/json" ,text/plain - - - filterAction - enforce - - - httpHeaders - Cache-Control: no-store, no-cache, must-revalidate, private - - - - - HttpHeaderSecurityFilter - /* - - - - ContentTypeBasedCachePreventionFilter - /* - - - - ApiOriginFilter - /* - - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 50e263c21d..4c0dfec5ef 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml deleted file mode 100644 index 783aa430c6..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - certificate-mgt - org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.certificate.mgt.v09.api - war - WSO2 Carbon - Certificate Management v09 API - WSO2 Carbon - Certificate Management v09 API - http://wso2.org - - - - - maven-compiler-plugin - - 1.8 - 1.8 - - - - maven-war-plugin - - WEB-INF/lib/*cxf*.jar - api#scep-mgt#v0.9 - - - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - - - - - deploy - - compile - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - compile - - run - - - - - - - - - - - - - - - - - - client - - test - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - test - - java - - - - - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - - - commons-codec.wso2 - commons-codec - - - commons-codec - commons-codec - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - cxf-rt-transports-http - - - junit - junit - test - - - javax.ws.rs - jsr311-api - provided - - - org.wso2.carbon - org.wso2.carbon.logging - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core - provided - - - io.swagger - swagger-annotations - - - io.swagger - swagger-core - - - org.wso2.orbit.com.fasterxml.jackson.core - jackson-annotations - - - org.slf4j - slf4j-api - - - - - io.swagger - swagger-jaxrs - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - - - org.slf4j - slf4j-api - - - - - javax.servlet - javax.servlet-api - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.annotations - provided - - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java deleted file mode 100644 index 8fca257828..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * / - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api; - -import io.swagger.annotations.*; - -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.certificate.mgt.jaxrs.beans.ErrorResponse; - -import javax.ws.rs.Consumes; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -@SwaggerDefinition( - info = @Info( - version = "0.9.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "SCEP Management"), - @ExtensionProperty(name = "context", value = "/api/device-mgt/v0.9/scep"), - }) - } - ), - tags = { - @Tag(name = "scep_management", description = "SCEP management related REST-API. " + - "This can be used to manipulated device " + - "certificate related details.") - } -) -@Path("/scep") -@Api(value = "SCEP Management", description = "This API carries all device Certificate management " + - "related operations.") -@Produces(MediaType.APPLICATION_JSON) -@Consumes(MediaType.APPLICATION_JSON) -@Scopes(scopes = { - @Scope( - name = "Sign CSR", - description = "Sign CSR", - key = "perm:sign-csr", - permissions = {"/device-mgt/certificates/manage"} - ) -} -) -public interface CertificateMgtService { - - String SCOPE = "scope"; - - /** - * Sign the client's certificate signing request and save it in the database. - * - * @param binarySecurityToken Base64 encoded Certificate signing request. - * @return X509Certificate type sign certificate. - */ - @POST - @Path("/sign-csr") - @Produces(MediaType.TEXT_PLAIN) - @Consumes(MediaType.TEXT_PLAIN) - @ApiOperation( - consumes = MediaType.TEXT_PLAIN, - produces = MediaType.TEXT_PLAIN, - httpMethod = "POST", - value = "Process a given CSR and return signed certificates.", - notes = "This will return a signed certificate upon a given CSR.", - tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "perm:sign-csr") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched the device location.", - response = String.class), - @ApiResponse( - code = 304, - message = "Not Modified. \n " + - "Empty body because the client already has the latest version of the requested resource."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error occurred while retrieving signed certificate.", - response = ErrorResponse.class) - }) - Response getSignedCertFromCSR( - @ApiParam( - name = "If-Modified-Since", - value = "Validates if the requested variant has not been modified since the time specified", - required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince, - String binarySecurityToken); -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorHandler.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorHandler.java deleted file mode 100644 index 0ba212c2b6..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.common; - -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; - -@Produces({ "application/json", "application/xml" }) -public class ErrorHandler implements ExceptionMapper { - - public Response toResponse(MDMAPIException exception) { - ErrorMessage errorMessage = new ErrorMessage(); - errorMessage.setErrorMessage(exception.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorMessage.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorMessage.java deleted file mode 100644 index d334fd88e8..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/ErrorMessage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.common; - - -public class ErrorMessage { - - private String errorMessage; - private String errorCode; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/GsonMessageBodyHandler.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/GsonMessageBodyHandler.java deleted file mode 100644 index ff866606ad..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/GsonMessageBodyHandler.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.common; - - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import java.io.*; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -@Provider -@Produces(APPLICATION_JSON) -@Consumes(APPLICATION_JSON) -public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { - - private Gson gson; - private static final String UTF_8 = "UTF-8"; - - public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - private Gson getGson() { - if (gson == null) { - final GsonBuilder gsonBuilder = new GsonBuilder(); - gson = gsonBuilder.create(); - } - return gson; - } - - public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) - throws IOException, WebApplicationException { - - InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8"); - - try { - return getGson().fromJson(reader, type); - } finally { - reader.close(); - } - } - - public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return -1; - } - - public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) - throws IOException, WebApplicationException { - - OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); - try { - getGson().toJson(object, type, writer); - } finally { - writer.close(); - } - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/MDMAPIException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/MDMAPIException.java deleted file mode 100644 index e6fe639ef6..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/common/MDMAPIException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.common; - -/** - * Custom exception class for handling CDM API related exceptions. - */ -public class MDMAPIException extends Exception { - - private static final long serialVersionUID = 7950151650447893900L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public MDMAPIException(String msg, Exception e) { - super(msg, e); - setErrorMessage(msg); - } - - public MDMAPIException(String msg, Throwable cause) { - super(msg, cause); - setErrorMessage(msg); - } - - public MDMAPIException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public MDMAPIException() { - super(); - } - - public MDMAPIException(Throwable cause) { - super(cause); - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/impl/CertificateMgtServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/impl/CertificateMgtServiceImpl.java deleted file mode 100644 index 06bcbcec8a..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/impl/CertificateMgtServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.impl; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.impl.CertificateGenerator; -import org.wso2.carbon.certificate.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.certificate.mgt.jaxrs.exception.UnexpectedServerErrorException; -import org.wso2.carbon.certificate.mgt.jaxrs.api.CertificateMgtService; -import org.wso2.carbon.certificate.mgt.jaxrs.exception.Message; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.security.cert.CertificateEncodingException; -import java.security.cert.X509Certificate; - -@Path("/scep") -public class CertificateMgtServiceImpl implements CertificateMgtService { - private static Log log = LogFactory.getLog(CertificateMgtServiceImpl.class); - - @POST - @Path("/sign-csr") - @Produces(MediaType.TEXT_PLAIN) - @Consumes(MediaType.TEXT_PLAIN) - public Response getSignedCertFromCSR( - @HeaderParam("If-Modified-Since") String ifModifiedSince, String binarySecurityToken) { - Message message = new Message(); - X509Certificate signedCert; - String singedCertificate; - Base64 base64 = new Base64(); - CertificateGenerator certificateGenerator = new CertificateGenerator(); - try { - if (certificateGenerator.getSignedCertificateFromCSR(binarySecurityToken) == null) { - message.setErrorMessage("Error occurred while signing the CSR."); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR). - entity(message).build(); - } else { - signedCert = certificateGenerator.getSignedCertificateFromCSR(binarySecurityToken); - singedCertificate = base64.encodeToString(signedCert.getEncoded()); - return Response.status(Response.Status.OK).entity(singedCertificate).build(); - } - } catch (KeystoreException e) { - String msg = "Error occurred while fetching certificate."; - log.error(msg, e); - throw new UnexpectedServerErrorException(new ErrorResponse.ErrorResponseBuilder().setCode( - 500l).setMessage(msg).build()); - } catch (CertificateEncodingException e) { - String msg = "Error occurred while encoding the certificate."; - log.error(msg, e); - throw new UnexpectedServerErrorException(new ErrorResponse.ErrorResponseBuilder().setCode( - 500l).setMessage(msg).build()); - } - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/util/ResponsePayload.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/util/ResponsePayload.java deleted file mode 100644 index 9451039854..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/util/ResponsePayload.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.api.util; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class ResponsePayload { - - private int statusCode; - private String messageFromServer; - private Object responseContent; - - @XmlElement - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - @XmlElement - public String getMessageFromServer() { - return messageFromServer; - } - - public void setMessageFromServer(String messageFromServer) { - this.messageFromServer = messageFromServer; - } - - @XmlElement - public Object getResponseContent() { - return responseContent; - } - - public void setResponseContent(Object responseContent) { - this.responseContent = responseContent; - } - - private ResponsePayloadBuilder getBuilder() { - return new ResponsePayloadBuilder(); - } - - public static ResponsePayloadBuilder statusCode(int statusCode) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().statusCode(statusCode); - } - - public static ResponsePayloadBuilder messageFromServer(String messageFromServer) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().messageFromServer(messageFromServer); - } - - public static ResponsePayloadBuilder responseContent(String responseContent) { - ResponsePayload message = new ResponsePayload(); - return message.getBuilder().responseContent(responseContent); - } - - public class ResponsePayloadBuilder { - - private int statusCode; - private String messageFromServer; - private Object responseContent; - - public ResponsePayloadBuilder statusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - public ResponsePayloadBuilder messageFromServer(String messageFromServer) { - this.messageFromServer = messageFromServer; - return this; - } - - public ResponsePayloadBuilder responseContent(String responseContent) { - this.responseContent = responseContent; - return this; - } - - public ResponsePayload build() { - ResponsePayload payload = new ResponsePayload(); - payload.setStatusCode(statusCode); - payload.setMessageFromServer(messageFromServer); - payload.setResponseContent(responseContent); - return payload; - } - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorListItem.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorListItem.java deleted file mode 100644 index 4b713af92b..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorListItem.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.NotNull; - -@ApiModel(description = "Error List Item") -public class ErrorListItem { - - @NotNull - private String code = null; - @NotNull - private String message = null; - - @ApiModelProperty(required = true, value = "") - @JsonProperty("code") - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public ErrorListItem() { - } - - public ErrorListItem(String code, String msg) { - this.code = code; - this.message = msg; - } - - - /** - * Description about individual errors occurred - */ - @ApiModelProperty(required = true, value = "Description about individual errors occurred") - @JsonProperty("message") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("errorItem {\n"); - sb.append(" code: ").append(code).append("\n"); - sb.append(" message: ").append(message).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorResponse.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorResponse.java deleted file mode 100644 index 7495874210..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/beans/ErrorResponse.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.certificate.mgt.jaxrs.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.ArrayList; -import java.util.List; - -@ApiModel(description = "Error Response") -public class ErrorResponse { - - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List errorItems = new ArrayList<>(); - - private ErrorResponse() { - } - - @JsonProperty(value = "code") - @ApiModelProperty(required = true, value = "") - public Long getCode() { - return code; - } - - public void setCode(Long code) { - this.code = code; - } - - @JsonProperty(value = "message") - @ApiModelProperty(required = true, value = "ErrorResponse message.") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @JsonProperty(value = "description") - @ApiModelProperty(value = "A detail description about the error message.") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty(value = "moreInfo") - @ApiModelProperty(value = "Preferably an url with more details about the error.") - public String getMoreInfo() { - return moreInfo; - } - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void addErrorListItem(ErrorListItem item) { - this.errorItems.add(item); - } - - /** - * If there are more than one error list them out. \nFor example, list out validation errors by each field. - */ - @JsonProperty(value = "errorItems") - @ApiModelProperty(value = "If there are more than one error list them out. \n" + - "For example, list out validation errors by each field.") - public List getErrorItems() { - return errorItems; - } - - public void setErrorItems(List error) { - this.errorItems = error; - } - - @Override - public String toString() { -// StringBuilder sb = new StringBuilder(); -// sb.append("{"); -// boolean cont = false; -// if (code != null) { -// cont = true; -// sb.append(" \"code\": ").append(code); -// } -// if (message != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"message\": \"").append(message).append("\""); -// } -// if (description != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"description\": ").append(description).append("\""); -// } -// if (moreInfo != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\""); -// } -// if (error != null && error.size() > 0) { -// if (cont) { -// sb.append(","); -// } -// sb.append(" \"errorItems\": ").append(error); -// } -// sb.append("}"); -// return sb.toString(); - return null; - } - - public static class ErrorResponseBuilder { - - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List error; - - - public ErrorResponseBuilder() { - this.error = new ArrayList<>(); - } - - public ErrorResponseBuilder setCode(long code) { - this.code = code; - return this; - } - - public ErrorResponseBuilder setMessage(String message) { - this.message = message; - return this; - } - - public ErrorResponseBuilder setDescription(String description) { - this.description = description; - return this; - } - - public ErrorResponseBuilder setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - return this; - } - - public ErrorResponseBuilder addErrorItem(String code, String msg) { - ErrorListItem item = new ErrorListItem(); - item.setCode(code); - item.setMessage(msg); - this.error.add(item); - return this; - } - - public ErrorResponse build() { - ErrorResponse errorResponse = new ErrorResponse(); - errorResponse.setCode(code); - errorResponse.setMessage(message); - errorResponse.setErrorItems(error); - errorResponse.setDescription(description); - errorResponse.setMoreInfo(moreInfo); - return errorResponse; - } - } - -} - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/BadRequestException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/BadRequestException.java deleted file mode 100644 index 380ecca287..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/BadRequestException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.exception; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -public class BadRequestException extends WebApplicationException { - - public BadRequestException(Message message, MediaType mediaType) { - super(Response.status(Response.Status.BAD_REQUEST).entity(message).type(mediaType).build()); - } - -} \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/Message.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/Message.java deleted file mode 100644 index 112d90381e..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/Message.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.certificate.mgt.jaxrs.exception; - -public class Message { - - private String errorMessage; - private String discription; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getDiscription() { - return discription; - } - - public void setDiscription(String discription) { - this.discription = discription; - } -} \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/UnexpectedServerErrorException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/UnexpectedServerErrorException.java deleted file mode 100644 index 2dd8bf46e5..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/exception/UnexpectedServerErrorException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.certificate.mgt.jaxrs.exception; - -import org.wso2.carbon.certificate.mgt.jaxrs.beans.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class UnexpectedServerErrorException extends WebApplicationException { - - private static final long serialVersionUID = 147943679458906890L; - - public UnexpectedServerErrorException(ErrorResponse error) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); - } - -} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/permissions.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/permissions.xml deleted file mode 100644 index c4401e110b..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/permissions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - get certificate in the database - /device-mgt/certificate/GetSignCSR - /certificates/scep/signcsr - POST - emm_admin - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index 8ec4d9fa45..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index 12e137e248..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 9c7b5bea47..0000000000 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - Certificate-Webapp - - JAX-WS/JAX-RS Certificate Management Endpoint - JAX-WS/JAX-RS Servlet - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - - - CXFServlet - /* - - - 60 - - - doAuthentication - true - - - isDefault - false - - - - - managed-api-enabled - true - - - managed-api-owner - admin - - - isSharedWithAllTenants - true - - - - HttpHeaderSecurityFilter - org.apache.catalina.filters.HttpHeaderSecurityFilter - - hstsEnabled - false - - - - - ContentTypeBasedCachePreventionFilter - org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter - - patterns - text/html" ,application/json" ,text/plain - - - filterAction - enforce - - - httpHeaders - Cache-Control: no-store, no-cache, must-revalidate, private - - - - - HttpHeaderSecurityFilter - /* - - - - ContentTypeBasedCachePreventionFilter - /* - - - diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index b179cec3d8..949665aa98 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org @@ -38,8 +38,6 @@ org.wso2.carbon.certificate.mgt.core org.wso2.carbon.certificate.mgt.api org.wso2.carbon.certificate.mgt.cert.admin.api - org.wso2.carbon.certificate.mgt.cert.admin.v09.api - org.wso2.carbon.certificate.mgt.v09.api diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 0cc3131ba6..58daee9d78 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index 00d8b1742a..1df100837c 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index e602b9624e..845a44dd00 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index 77a1068fb4..6827c8cd9c 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 29a78f4ac0..f61c712fb5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index f79d79b492..d5e08e6501 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 13714047a0..c0e75b0e3b 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 18f0b7b855..bfe96542ed 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml index 4b31a9287a..fd793bf2a0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml @@ -20,7 +20,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT 4.0.0 diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 373a245cba..cdd562587a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index 659276becb..6000845829 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -48,6 +48,7 @@ import io.swagger.annotations.ResponseHeader; import org.apache.axis2.transport.http.HTTPConstants; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList; import org.wso2.carbon.device.mgt.jaxrs.beans.Credential; @@ -155,6 +156,12 @@ import java.util.List; description = "Sending Enrollment Invitations to Users", key = "perm:users:send-invitation", permissions = {"/device-mgt/users/manage"} + ), + @Scope( + name = "Get activities", + description = "Get activities", + key = "perm:get-activity", + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) @@ -924,4 +931,80 @@ public interface UserManagementService { @POST @Path("/validate") Response validateUser(Credential credential); + + @GET + @Path("/device/activities") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Activity Details", + notes = "Get the details of the operations/activities executed by the server on the devices registered" + + " with WSO2 EMM, during a defined time period.", + tags = "Activity Info Provider", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the activity details.", + response = ActivityList.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client already has the latest version of the" + + " requested resource.\n"), + @ApiResponse( + code = 401, + message = "Unauthorized. \n Unauthorized request."), + @ApiResponse( + code = 404, + message = "Not Found. \n No activities found.", + response = ErrorResponse.class), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the activity data.", + response = ErrorResponse.class) + }) + Response getActivities( + @ApiParam( + name = "since", + value = "Checks if the requested variant was created since the specified date-time.\n" + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + + "Example: Mon, 05 Jan 2014 15:10:00 +0200") + @QueryParam("since") String since, + @ApiParam( + name = "offset", + value = "The starting pagination index for the complete list of qualified items.", + defaultValue = "0") + @QueryParam("offset") int offset, + @ApiParam( + name = "limit", + value = "Provide how many activity details you require from the starting pagination index/offset.", + defaultValue = "5") + @QueryParam("limit") int limit, + @ApiParam( + name = "If-Modified-Since", + value = "Checks if the requested variant was modified, since the specified date-time\n." + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z\n." + + "Example: Mon, 05 Jan 2014 15:10:00 +0200") + @HeaderParam("If-Modified-Since") String ifModifiedSince); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index 0ac0677151..b96977adfb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -32,6 +32,7 @@ import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.util.Constants; @@ -39,6 +40,7 @@ import javax.validation.constraints.Size; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import java.util.List; @SwaggerDefinition( info = @Info( @@ -68,6 +70,12 @@ import javax.ws.rs.core.Response; description = "Getting Details of a Device", key = "perm:admin:devices:view", permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Update the Device Owner", + description = "Update the ownership of the device", + key = "perm:admin:devices:update-enrollment", + permissions = {"/device-mgt/admin/devices/update-enrollment"} ) } ) @@ -167,4 +175,54 @@ public interface DeviceManagementAdminService { required = false, defaultValue = "5") @QueryParam("limit") int limit); + + @PUT + @Path("/device-owner") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "PUT", + value = "Update the device owner", + notes = "Update enrollment owner for given device Identifiers.", + tags = "Device Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:devices:update-enrollment") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully update the owner of devices.", + response = DeviceList.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 400, + message = "The incoming request has more than one selection criteria defined via the query parameters.", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the device list.", + response = ErrorResponse.class) + }) Response updateEnrollOwner( + @ApiParam( + name = "Device Owner", + value = "The username that is going to use for the new device owner of given devices.", + required = true) + @QueryParam("owner") String owner, + @ApiParam( + name = "Device Identifiers", + value = "List of device identifiers.", + required = true) + List deviceIdentifiers); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index dae2bbbf53..329c559903 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -39,12 +39,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; import org.eclipse.wst.common.uriresolver.internal.util.URIEncoder; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; +import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoWrapper; @@ -88,8 +92,11 @@ import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.security.SecureRandom; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -793,8 +800,96 @@ public class UserManagementServiceImpl implements UserManagementService { } catch (UserStoreException e) { String msg = "Error occurred while retrieving user store to validate user"; log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + return Response.serverError().entity(new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()) + .build(); + } + } + + @GET + @Override + @Path("/device/activities") + public Response getActivities( + @QueryParam("since") String since, + @QueryParam("offset") int offset, + @QueryParam("limit") int limit, + @HeaderParam("If-Modified-Since") String ifModifiedSince) { + long ifModifiedSinceTimestamp; + long sinceTimestamp; + long timestamp = 0; + boolean isIfModifiedSinceSet = false; + String initiatedBy; + if (log.isDebugEnabled()) { + log.debug("getActivities since: " + since + " , offset: " + offset + " ,limit: " + limit + " ," + + "ifModifiedSince: " + ifModifiedSince); + } + RequestValidationUtil.validatePaginationParameters(offset, limit); + if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { + Date ifSinceDate; + SimpleDateFormat format = new SimpleDateFormat(Constants.DEFAULT_SIMPLE_DATE_FORMAT); + try { + ifSinceDate = format.parse(ifModifiedSince); + } catch (ParseException e) { + return Response.status(400).entity(new ErrorResponse.ErrorResponseBuilder() + .setMessage("Invalid date string is provided in 'If-Modified-Since' header").build()).build(); + } + ifModifiedSinceTimestamp = ifSinceDate.getTime(); + isIfModifiedSinceSet = true; + timestamp = ifModifiedSinceTimestamp / 1000; + } else if (since != null && !since.isEmpty()) { + Date sinceDate; + SimpleDateFormat format = new SimpleDateFormat(Constants.DEFAULT_SIMPLE_DATE_FORMAT); + try { + sinceDate = format.parse(since); + } catch (ParseException e) { + return Response.status(400).entity(new ErrorResponse.ErrorResponseBuilder() + .setMessage("Invalid date string is provided in 'since' filter").build()).build(); + } + sinceTimestamp = sinceDate.getTime(); + timestamp = sinceTimestamp / 1000; + } + + if (timestamp == 0) { + //If timestamp is not sent by the user, a default value is set, that is equal to current time-12 hours. + long time = System.currentTimeMillis() / 1000; + timestamp = time - 42300; + } + if (log.isDebugEnabled()) { + log.debug("getActivities final timestamp " + timestamp); + } + + List activities; + int count; + ActivityList activityList = new ActivityList(); + DeviceManagementProviderService dmService; + + initiatedBy = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + try { + if (log.isDebugEnabled()) { + log.debug("Calling database to get activities."); + } + dmService = DeviceMgtAPIUtils.getDeviceManagementService(); + activities = dmService.getActivitiesUpdatedAfterByUser(timestamp, initiatedBy, limit, offset); + if (log.isDebugEnabled()) { + log.debug("Calling database to get activity count with timestamp and user."); + } + count = dmService.getActivityCountUpdatedAfterByUser(timestamp, initiatedBy); + if (log.isDebugEnabled()) { + log.debug("Activity count: " + count); + } + + activityList.setList(activities); + activityList.setCount(count); + if ((activities == null || activities.isEmpty()) && isIfModifiedSinceSet) { + return Response.notModified().build(); + } + return Response.ok().entity(activityList).build(); + } catch (OperationManagementException e) { + String msg = + "Error Response occurred while fetching the activities updated after given time stamp for the user " + + initiatedBy + "."; + log.error(msg, e); + return Response.serverError().entity(new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()) + .build(); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index a6d98fc73c..38e5804751 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -20,18 +20,23 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl.admin; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.solr.common.StringUtils; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.StringUtil; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.UserNotFoundException; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceManagementAdminService; import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; +import javax.validation.constraints.Past; import javax.validation.constraints.Size; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -87,4 +92,32 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe } } + @PUT + @Override + @Path("/device-owner") + public Response updateEnrollOwner( + @QueryParam("owner") String owner, + List deviceIdentifiers){ + try { + if (DeviceMgtAPIUtils.getDeviceManagementService().updateEnrollment(owner, deviceIdentifiers)){ + String msg = "Device owner is updated successfully."; + return Response.status(Response.Status.OK).entity(msg).build(); + } + String msg = "Device owner updating is failed."; + log.error(msg); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch(InvalidDeviceException e){ + String msg = "Invalid device identifiers are found with the request."; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + }catch (DeviceManagementException e) { + String msg = "Error occurred when updating device owners."; + log.error(msg); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch (UserNotFoundException e) { + String msg = "Couldn't found the owner in user store to update the owner of devices."; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/Constants.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/Constants.java index 728c461c7b..4525cdd38d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/Constants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/Constants.java @@ -30,6 +30,7 @@ public class Constants { public static final String DEFAULT_STREAM_VERSION = "1.0.0"; public static final String SCOPE = "scope"; public static final String JDBC_USERSTOREMANAGER = "org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager"; + public static final String DEFAULT_SIMPLE_DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; public static final int DEFAULT_PAGE_LIMIT = 50; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 03cf504ccd..eb7b99a2a4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/UserNotFoundException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/UserNotFoundException.java new file mode 100644 index 0000000000..640e28b752 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/UserNotFoundException.java @@ -0,0 +1,44 @@ +package org.wso2.carbon.device.mgt.common; +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class UserNotFoundException extends Exception { + + private static final long serialVersionUID = -5705727414452641634L; + + public UserNotFoundException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public UserNotFoundException(String message, Throwable cause) { + super(message, cause); + } + + public UserNotFoundException(String msg) { + super(msg); + } + + public UserNotFoundException() { + super(); + } + + public UserNotFoundException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 98b466d960..73ff60d2d7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index e768749d7f..93a254d2c7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -426,5 +426,16 @@ public interface DeviceDAO { */ List findGeoClusters(String deviceType, GeoCoordinate southWest, GeoCoordinate northEast, int geohashLength,int tenantId) throws DeviceManagementDAOException; + + /*** + * This method is used to identify whether given device ids are exist or not. + * + * @param deviceIdentifiers List of device identifiers. + * @param tenantId tenant id. + * @return returns list of device ids that matches with device identifiers. + * @throws DeviceManagementDAOException throws {@link DeviceManagementDAOException} if connections establishment + * fails. + */ + List getDevicesByIdentifiers(List deviceIdentifiers, int tenantId) throws DeviceManagementDAOException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/EnrollmentDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/EnrollmentDAO.java index 843e8df646..b8230d6cf2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/EnrollmentDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/EnrollmentDAO.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.mgt.core.dao; +import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; @@ -50,4 +51,16 @@ public interface EnrollmentDAO { List getEnrollmentsOfUser(int deviceId, String user, int tenantId) throws DeviceManagementDAOException; + /*** + *This method is used to update the owner of the enrollment for given set of devices to given user. + * + * @param devices List of devices. + * @param owner Username of the new device owner. + * @param tenantId tenant id. + * @return either (1) true, if device owner updating is succeed or false. + * @throws DeviceManagementDAOException if an error occurs when updating device owner. + */ + boolean updateOwnerOfEnrollment(List devices, String owner, int tenantId) + throws DeviceManagementDAOException; + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 66e15a47cf..1e8a01e244 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -40,6 +40,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.StringJoiner; public abstract class AbstractDeviceDAOImpl implements DeviceDAO { @@ -1245,4 +1246,53 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { } return geoClusters; } + + @Override + public List getDevicesByIdentifiers(List deviceIdentifiers, int tenantId) + throws DeviceManagementDAOException { + try { + Connection conn = this.getConnection(); + int index = 1; + int counter = 0; + List devices = new ArrayList<>(); + + StringJoiner joiner = new StringJoiner(",", + "SELECT " + + "d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + + "d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " + + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID " + + "FROM " + + "DM_ENROLMENT e, " + + "(SELECT d.ID, d.DESCRIPTION, d.NAME, t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION " + + "FROM DM_DEVICE d, DM_DEVICE_TYPE t " + + "WHERE " + + "t.ID = d.DEVICE_TYPE_ID AND d.DEVICE_IDENTIFICATION IN (", + ") AND d.TENANT_ID = ?) d1 " + + "WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ? " + + "ORDER BY e.DATE_OF_LAST_UPDATE DESC, e.STATUS ASC"); + while (counter < deviceIdentifiers.size()) { + joiner.add("?"); + counter++; + } + String query = joiner.toString(); + try (PreparedStatement ps = conn.prepareStatement(query)) { + for (String identifier : deviceIdentifiers) { + ps.setObject(index++, identifier); + } + ps.setInt(index++, tenantId); + ps.setInt(index, tenantId); + try (ResultSet rs = ps.executeQuery()) { + if (rs.next()) { + Device device = DeviceManagementDAOUtil.loadDevice(rs); + devices.add(device); + } + } + } + return devices; + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection when adding tags", + e); + } + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java index 89e20dc242..7bbb94bc89 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.mgt.core.dao.impl; +import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; @@ -28,6 +29,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; @@ -361,6 +363,44 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { } } + @Override + public boolean updateOwnerOfEnrollment(List devices, String owner, int tenantId) + throws DeviceManagementDAOException { + try { + Connection conn = this.getConnection(); + boolean updateStatus = true; + String sql = "UPDATE DM_ENROLMENT SET OWNER = ? WHERE ID = ? AND TENANT_ID = ?"; + try (PreparedStatement ps = conn.prepareStatement(sql)) { + if (conn.getMetaData().supportsBatchUpdates()) { + for (Device device : devices) { + ps.setString(1, owner); + ps.setInt(2, device.getId()); + ps.setInt(3, tenantId); + ps.addBatch(); + } + for (int i : ps.executeBatch()) { + if (i == 0 || i == Statement.SUCCESS_NO_INFO || i == Statement.EXECUTE_FAILED) { + updateStatus = false; + } + } + } else { + for (Device device : devices) { + ps.setString(1, owner); + ps.setInt(2, device.getId()); + ps.setInt(3, tenantId); + if (ps.executeUpdate() == 0) { + updateStatus = false; + } + } + } + } + return updateStatus; + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while obtaining the DB connection when adding tags", + e); + } + } + private Connection getConnection() throws SQLException { return DeviceManagementDAOFactory.getConnection(); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index f265509910..39937baae4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -67,11 +67,27 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceId, false); DeviceManagementDAOFactory.beginTransaction(); + DeviceInfo newDeviceInfo; + DeviceInfo previousDeviceInfo = deviceDetailsDAO.getDeviceInformation(device.getId(), + device.getEnrolmentInfo().getId()); + Map previousDeviceProperties = deviceDetailsDAO.getDeviceProperties(device.getId(), + device.getEnrolmentInfo().getId()); + if (previousDeviceInfo != null && previousDeviceProperties != null) { + previousDeviceInfo.setDeviceDetailsMap(previousDeviceProperties); + newDeviceInfo = processDeviceInfo(previousDeviceInfo, deviceInfo); + } else if (previousDeviceInfo == null && previousDeviceProperties != null) { + previousDeviceInfo = new DeviceInfo(); + previousDeviceInfo.setDeviceDetailsMap(previousDeviceProperties); + newDeviceInfo = processDeviceInfo(previousDeviceInfo, deviceInfo); + } else { + newDeviceInfo = deviceInfo; + } + deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId()); deviceDetailsDAO.deleteDeviceInformation(device.getId(), device.getEnrolmentInfo().getId()); deviceDetailsDAO.deleteDeviceProperties(device.getId(), device.getEnrolmentInfo().getId()); - deviceDetailsDAO.addDeviceInformation(device.getId(), device.getEnrolmentInfo().getId(), deviceInfo); - deviceDetailsDAO.addDeviceProperties(deviceInfo.getDeviceDetailsMap(), device.getId(), + deviceDetailsDAO.addDeviceInformation(device.getId(), device.getEnrolmentInfo().getId(), newDeviceInfo); + deviceDetailsDAO.addDeviceProperties(newDeviceInfo.getDeviceDetailsMap(), device.getId(), device.getEnrolmentInfo().getId()); DeviceManagementDAOFactory.commitTransaction(); @@ -291,5 +307,67 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { } } + private DeviceInfo processDeviceInfo(DeviceInfo previousDeviceInfo, DeviceInfo newDeviceInfo) { + if (newDeviceInfo.getDeviceModel().isEmpty()) { + newDeviceInfo.setDeviceModel(previousDeviceInfo.getDeviceModel()); + } + if (newDeviceInfo.getVendor().isEmpty()) { + newDeviceInfo.setVendor(previousDeviceInfo.getVendor()); + } + if (newDeviceInfo.getOsBuildDate().isEmpty()) { + newDeviceInfo.setOsBuildDate(previousDeviceInfo.getOsBuildDate()); + } + if (newDeviceInfo.getOsVersion().isEmpty()) { + newDeviceInfo.setOsVersion(previousDeviceInfo.getOsVersion()); + } + if (newDeviceInfo.getBatteryLevel() == -1D) { + newDeviceInfo.setBatteryLevel(previousDeviceInfo.getBatteryLevel()); + } + if (newDeviceInfo.getInternalTotalMemory() == -1D) { + newDeviceInfo.setInternalTotalMemory(previousDeviceInfo.getInternalTotalMemory()); + } + if (newDeviceInfo.getInternalAvailableMemory() == -1D) { + newDeviceInfo.setInternalAvailableMemory(previousDeviceInfo.getInternalAvailableMemory()); + } + if (newDeviceInfo.getExternalTotalMemory() == -1D) { + newDeviceInfo.setExternalTotalMemory(previousDeviceInfo.getExternalTotalMemory()); + } + if (newDeviceInfo.getExternalAvailableMemory() == -1D) { + newDeviceInfo.setExternalAvailableMemory(previousDeviceInfo.getExternalAvailableMemory()); + } + if (newDeviceInfo.getOperator().isEmpty()) { + newDeviceInfo.setOperator(previousDeviceInfo.getOperator()); + } + if (newDeviceInfo.getConnectionType().isEmpty()) { + newDeviceInfo.setConnectionType(previousDeviceInfo.getConnectionType()); + } + if (newDeviceInfo.getMobileSignalStrength() == 0.0) { + newDeviceInfo.setMobileSignalStrength(previousDeviceInfo.getMobileSignalStrength()); + } + if (newDeviceInfo.getSsid().isEmpty()) { + newDeviceInfo.setSsid(previousDeviceInfo.getSsid()); + } + if (newDeviceInfo.getCpuUsage() == 0.0) { + newDeviceInfo.setCpuUsage(previousDeviceInfo.getCpuUsage()); + } + if (newDeviceInfo.getTotalRAMMemory() == -1D) { + newDeviceInfo.setTotalRAMMemory(previousDeviceInfo.getTotalRAMMemory()); + } + if (newDeviceInfo.getAvailableRAMMemory() == -1D) { + newDeviceInfo.setAvailableRAMMemory(previousDeviceInfo.getAvailableRAMMemory()); + } + if (!newDeviceInfo.isPluggedIn()) { + newDeviceInfo.setPluggedIn(previousDeviceInfo.isPluggedIn()); + } + Map newDeviceDetailsMap = newDeviceInfo.getDeviceDetailsMap(); + Map previousDeviceDetailsMap = previousDeviceInfo.getDeviceDetailsMap(); + for (String eachKey : previousDeviceDetailsMap.keySet()) { + if (!newDeviceDetailsMap.containsKey(eachKey)) { + newDeviceDetailsMap.put(eachKey, previousDeviceDetailsMap.get(eachKey)); + } + } + return newDeviceInfo; + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index c970b593cb..291a636678 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -27,6 +27,7 @@ import org.wso2.carbon.device.mgt.common.MonitoringOperation; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; +import org.wso2.carbon.device.mgt.common.UserNotFoundException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.license.mgt.License; @@ -666,4 +667,7 @@ public interface DeviceManagementProviderService { List getDeviceIdentifiersByStatus(String deviceType, String deviceStatus) throws DeviceManagementException; boolean bulkUpdateDeviceStatus(String deviceType, List deviceList, String status) throws DeviceManagementException; + + boolean updateEnrollment(String owner, List deviceIdentifiers) + throws DeviceManagementException, UserNotFoundException, InvalidDeviceException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index c7a3a5aabc..5e6205b87e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -53,6 +53,7 @@ import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.TransactionManagementException; +import org.wso2.carbon.device.mgt.common.UserNotFoundException; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; @@ -2826,7 +2827,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv success = deviceDAO.setEnrolmentStatusInBulk(deviceType, status, tenantId, deviceList); DeviceManagementDAOFactory.commitTransaction(); } catch (DeviceManagementDAOException e) { - String msg = "Error occurred in while updating status of devices :" +deviceType + " status : " + deviceList.toString(); + String msg = "Error occurred in while updating status of devices :" + deviceType + " status : " + deviceList + .toString(); log.error(msg, e); throw new DeviceManagementException(msg, e); } catch (SQLException e) { @@ -2839,6 +2841,66 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return success; } + public boolean updateEnrollment(String owner, List deviceIdentifiers) + throws DeviceManagementException, UserNotFoundException, InvalidDeviceException { + + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + List existingDevices; + owner = validateOwner(owner, tenantId); + try { + DeviceManagementDAOFactory.beginTransaction(); + existingDevices = deviceDAO.getDevicesByIdentifiers(deviceIdentifiers, tenantId); + if (existingDevices.size() != deviceIdentifiers.size()) { + for (Device device : existingDevices) { + deviceIdentifiers.remove(device.getDeviceIdentifier()); + } + String msg = + "Couldn't find device ids for requested all device identifiers. Therefore payload should " + + "contains device identifiers which are not in the system. Invalid device " + + "identifiers are " + deviceIdentifiers.toString(); + log.error(msg); + throw new InvalidDeviceException(msg); + } + if (enrollmentDAO.updateOwnerOfEnrollment(existingDevices, owner, tenantId)) { + DeviceManagementDAOFactory.commitTransaction(); + return true; + } + DeviceManagementDAOFactory.rollbackTransaction(); + return false; + } catch (TransactionManagementException e) { + String msg = "Error occurred while initiating transaction"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred either verifying existence of device ids or updating owner of the device."; + log.error(msg); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + private String validateOwner(String owner, int tenantId) throws UserNotFoundException, DeviceManagementException { + try { + if (StringUtils.isEmpty(owner)) { + owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + } else { + boolean isUserExisit = DeviceManagementDataHolder.getInstance().getRealmService() + .getTenantUserRealm(tenantId).getUserStoreManager().isExistingUser(owner); + if (!isUserExisit) { + String msg = "Owner does not exist in the user storage. Owner: " + owner; + log.error(msg); + throw new UserNotFoundException(msg); + } + } + return owner; + } catch (UserStoreException e) { + String msg = "Error occurred when checking whether owner is exist or not. Owner: " + owner; + log.error(msg); + throw new DeviceManagementException(msg, e); + } + } + private void extractDeviceLocationToUpdate(Device device) { List properties = device.getProperties(); if (properties != null) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 9586b2dcc8..2955636588 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 29a19dfc35..7fdec2aefa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.2.2-SNAPSHOT + 3.2.5-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js index e36069f802..1c84db0261 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js @@ -223,6 +223,7 @@ policyModule = function () { appObjectToView = {}; appObjectToView["appName"] = appObjectFromRestEndpoint["name"]; appObjectToView["appId"] = appObjectFromRestEndpoint["id"]; + appObjectToView["webUrl"] = appObjectFromRestEndpoint["appmeta"]["weburl"]; if ("webapp" === appObjectFromRestEndpoint["platform"]) { appObjectToView["packageName"] = appObjectFromRestEndpoint["appmeta"]["weburl"]; appObjectToView["type"] = "Web Clip" diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs index 67f867622b..9a2df65f5e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.cookie-policy/cookie-policy.hbs @@ -26,14 +26,14 @@

About Entgra IoT Server

-

Entgra IoT Server 3.4.0 is a complete solution that enables device manufacturers and enterprises to +

Entgra IoT Server 3.5.0 is a complete solution that enables device manufacturers and enterprises to connect and manage their devices, build apps, manage events, secure devices and data, and visualize sensor data in a scalable manner.

It also offers a complete and secure Enterprise Mobility Management (EMM/MDM) solution that aims to address mobile computing challenges faced by enterprises today. Supporting iOS, Android, and Windows devices, it helps organizations deal with both Corporate Owned, Personally Enabled (COPE) and employee-owned devices with the Bring Your Own Device (BYOD) concept.

-

Entgra IoT Server 3.4.0 comes with advanced analytics, enabling users to analyze speed, proximity, and +

Entgra IoT Server 3.5.0 comes with advanced analytics, enabling users to analyze speed, proximity, and geo-fencing information of devices including details of those in motion and stationary state.

Cookie Policy

@@ -45,12 +45,12 @@ apps remember things about you. Other technologies, including Web storage and identifiers associated with your device, may be used for similar purposes. In this policy, we use the term “cookies” to discuss all of these technologies.

-

How does Entgra IoT Server 3.4.0 process cookies?

-

Entgra IoT Server 3.4.0 uses cookies to store and retrieve information on your browser. This +

How does Entgra IoT Server 3.5.0 process cookies?

+

Entgra IoT Server 3.5.0 uses cookies to store and retrieve information on your browser. This information is used to provide a better user experience. Some cookies serve the purpose of allowing a user to log in to the system, maintain sessions, and keep track of activities within the login session.

-

Some cookies in Entgra IoT Server 3.4.0 are used to personally identify you. However, the cookie +

Some cookies in Entgra IoT Server 3.5.0 are used to personally identify you. However, the cookie lifetime ends once your session ends, i.e., after you log-out, or after the session expiry time has elapsed.

Some cookies are simply used to give you a more personalised web experience, and these cannot be used @@ -58,42 +58,42 @@

This Cookie Policy is part of the IoT Server Privacy Policy.

What does Entgra IoT Server 3.0.0 use cookies for?

-

Cookies are used for two purposes in Entgra IoT Server 3.4.0.

+

Cookies are used for two purposes in Entgra IoT Server 3.5.0.

  1. To identify you and provide security
  2. To provide a satisfying user experience.

Preferences

-

Entgra IoT Server 3.4.0 uses cookies to remember your settings and preferences and to auto-fill the +

Entgra IoT Server 3.5.0 uses cookies to remember your settings and preferences and to auto-fill the fields to make your interactions with the site easier.

These cookies can not be used to personally identify you.

Security

    -
  1. Entgra IoT Server 3.4.0 uses selected cookies to identify and prevent security risks. For example, - Entgra IoT Server 3.4.0 may use cookies to store your session information to prevent others from +
  2. Entgra IoT Server 3.5.0 uses selected cookies to identify and prevent security risks. For example, + Entgra IoT Server 3.5.0 may use cookies to store your session information to prevent others from changing your password without your username and password.
  3. -
  4. Entgra IoT Server 3.4.0 uses session cookie to maintain your active session.
  5. -
  6. Entgra IoT Server 3.4.0 may use a temporary cookie when performing multi-factor authentication and +
  7. Entgra IoT Server 3.5.0 uses session cookie to maintain your active session.
  8. +
  9. Entgra IoT Server 3.5.0 may use a temporary cookie when performing multi-factor authentication and federated authentication.
  10. -
  11. Entgra IoT Server 3.4.0 may use permanent cookies to detect the devices you have logged in +
  12. Entgra IoT Server 3.5.0 may use permanent cookies to detect the devices you have logged in previously. This is to to calculate the risk level associated with your current login attempt. Using these cookies protects you and your account from possible attacks.

Performance

-

Entgra IoT Server 3.4.0 may use cookies to allow Remember Me functionalities.

+

Entgra IoT Server 3.5.0 may use cookies to allow Remember Me functionalities.

Analytics

-

Entgra IoT Server 3.4.0 as a product does not use cookies for analytical purposes.

+

Entgra IoT Server 3.5.0 as a product does not use cookies for analytical purposes.

Third party cookies

-

Using Entgra IoT Server 3.4.0 may cause third-party cookie to be set in your browser. Entgra IoT Server - 3.4.0 has no control over how any of them operate. The third-party cookies that maybe set +

Using Entgra IoT Server 3.5.0 may cause third-party cookie to be set in your browser. Entgra IoT Server + 3.5.0 has no control over how any of them operate. The third-party cookies that maybe set include:

    -
  1. Any social login sites. For example, third-party cookies may be set when Entgra IoT Server 3.4.0 +
  2. Any social login sites. For example, third-party cookies may be set when Entgra IoT Server 3.5.0 is configured to use “social” or “federated” login, and you opt to login with your “Social Account”.
  3. @@ -101,11 +101,11 @@

Entgra strongly advises you to refer the respective cookie policies of such sites carefully as Entgra has no knowledge or use on these cookies.

-

What type of cookies does Entgra IoT Server 3.4.0 use?

-

Entgra IoT Server 3.4.0 uses persistent cookies and session cookies. A persistent cookie helps Entgra IS - 3.4.0 to recognize you as an existing user so that it is easier to return to Entgra or interact with - Entgra IS 3.4.0 without signing in again. After you sign in, a persistent cookie stays in your browser - and will be read by Entgra IoT Server 3.4.0 when you return to Entgra IoT Server 3.4.0.

+

What type of cookies does Entgra IoT Server 3.5.0 use?

+

Entgra IoT Server 3.5.0 uses persistent cookies and session cookies. A persistent cookie helps Entgra IS + 3.5.0 to recognize you as an existing user so that it is easier to return to Entgra or interact with + Entgra IS 3.5.0 without signing in again. After you sign in, a persistent cookie stays in your browser + and will be read by Entgra IoT Server 3.5.0 when you return to Entgra IoT Server 3.5.0.

A session cookie is a cookie that is erased when the user closes the Web browser. The session cookie is stored in temporarily and is not retained after the browser is closed. Session cookies do not collect information from the user’s computer.

@@ -114,9 +114,9 @@ for websites to set cookies, you may worsen your overall user experience since it will no longer be personalized to you. It may also stop you from saving customized settings like login information. Most likely, disabling cookies will make it unable for you to use authentication and authorization - functionalities offered by Entgra IoT Server 3.4.0.

+ functionalities offered by Entgra IoT Server 3.5.0.

If you have any questions or concerns regarding the use of cookies, please contact the entity or - individuals (or their data protection officer, if applicable) running this Entgra IoT Server 3.4.0 + individuals (or their data protection officer, if applicable) running this Entgra IoT Server 3.5.0 instance.

What are the cookies used?

@@ -150,17 +150,17 @@

Disclaimer

-

This cookie policy is only for illustrative purposes of the product Entgra IoT Server 3.4.0. The +

This cookie policy is only for illustrative purposes of the product Entgra IoT Server 3.5.0. The content in the policy is technically correct at the time of the product shipment. The - entity,organization or individual that runs this Entgra IoT Server 3.4.0 instance has full authority + entity,organization or individual that runs this Entgra IoT Server 3.5.0 instance has full authority and responsibility with regard to the effective Cookie Policy. Entgra, its employees, partners, and affiliates do not have access to and do not require, store, process or control any of the data, - including personal data contained in Entgra IoT Server 3.4.0. All data, including personal data is - controlled and processed by the entity, organization or individual running Entgra IoT Server 3.4.0. + including personal data contained in Entgra IoT Server 3.5.0. All data, including personal data is + controlled and processed by the entity, organization or individual running Entgra IoT Server 3.5.0. Entgra, its employees partners and affiliates are not a data processor or a data controller within the meaning of any data privacy regulations. Entgra does not provide any warranties or undertake any responsibility or liability in connection with the lawfulness or the manner and purposes for which - Entgra IoT Server 3.4.0 is used by such entities, organizations or persons.

+ Entgra IoT Server 3.5.0 is used by such entities, organizations or persons.

diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index da067de434..23d9ac28e0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs @@ -92,11 +92,11 @@
+ style="background-color: #008cc4; height: 152px;">
-
+
Overview
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs index b2f67283ee..dbcb7d89ab 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.privacy-policy/privacy-policy.hbs @@ -36,18 +36,18 @@

Entgra IoT Server comes with advanced analytics, enabling users to analyze speed, proximity, and geo-fencing information of devices including details of those in motion and stationary state.

Privacy Policy

-

This policy describes how Entgra IoT Server 3.4.0 captures your personal information, the purposes of +

This policy describes how Entgra IoT Server 3.5.0 captures your personal information, the purposes of collection, and information about the retention of your personal information.

Please note that this policy is for reference only, and is applicable for the software as a product. Entgra and its developers have no access to the information held within Entgra IoT Server - 3.4.0.Please see the Disclaimer section for more information. Entities, organisations or individuals - controlling the use and administration of Entgra IoT Server 3.4.0 should create their own privacy + 3.5.0.Please see the Disclaimer section for more information. Entities, organisations or individuals + controlling the use and administration of Entgra IoT Server 3.5.0 should create their own privacy policies setting out the manner in which data is controlled or processed by the respective entity, organisation or individual.

What is personal information?

-

Entgra IoT Server 3.4.0 considers anything related to you and by which you may be identified as your +

Entgra IoT Server 3.5.0 considers anything related to you and by which you may be identified as your personal information.

-

Signing in to Entgra IoT Server 3.4.0

+

Signing in to Entgra IoT Server 3.5.0

  1. Your user name (except in cases where the user name created by your employer is under contract) @@ -55,7 +55,7 @@
  2. IP address used to log in
  3. Email address
-

Enrolling a device with Entgra IoT Server 3.4.0

+

Enrolling a device with Entgra IoT Server 3.5.0

  • Your device ID (e.g., phone or tablet), mobile number, IMEI number, and IMSI number
  • Your device’s location
  • @@ -64,7 +64,7 @@ memory usage
-

However, Entgra IoT Server 3.4.0 also collects the following information that is not considered +

However, Entgra IoT Server 3.5.0 also collects the following information that is not considered personal information, but is used only for statistical purposes. The reason for this is that this information can not be used to track you.

    @@ -74,17 +74,17 @@
  • Operating system and generic browser information

Collection of personal information

-

Entgra IoT Server 3.4.0 collects your information only to serve your access requirements. For example: +

Entgra IoT Server 3.5.0 collects your information only to serve your access requirements. For example:

    -
  • Entgra IoT Server 3.4.0 uses your IP address to detect any suspicious login attempts to your +
  • Entgra IoT Server 3.5.0 uses your IP address to detect any suspicious login attempts to your account. -
  • Entgra IoT Server 3.4.0 uses attributes like your first name, last name, etc., to provide a rich +
  • Entgra IoT Server 3.5.0 uses attributes like your first name, last name, etc., to provide a rich and personalized user experience. -
  • Entgra IoT Server 3.4.0 uses your security questions and answers only to allow account recovery. +
  • Entgra IoT Server 3.5.0 uses your security questions and answers only to allow account recovery.

Tracking Technologies

-

Entgra IoT Server 3.4.0 collects your information by:

+

Entgra IoT Server 3.5.0 collects your information by:

  • Collecting information from the user profile page where you enter your personal data.
  • Tracking your IP address with HTTP request, HTTP headers, and TCP/IP.
  • @@ -95,15 +95,15 @@

Use of personal information

-

Entgra IoT Server 3.4.0 will only use your personal information for the purposes for which it was +

Entgra IoT Server 3.5.0 will only use your personal information for the purposes for which it was collected (or for a use identified as consistent with that purpose).

-

Entgra IoT Server 3.4.0 uses your personal information only for the following purposes.

+

Entgra IoT Server 3.5.0 uses your personal information only for the following purposes.

    -
  • To provide you with a personalized user experience. Entgra IoT Server 3.4.0 uses your name and +
  • To provide you with a personalized user experience. Entgra IoT Server 3.5.0 uses your name and uploaded profile pictures for this purpose.
  • To protect your account from unauthorized access or potential hacking attempts. Entgra IoT Server - 3.4.0 uses HTTP or TCP/IP Headers for this purpose. + 3.5.0 uses HTTP or TCP/IP Headers for this purpose.
  • This includes:

    @@ -114,10 +114,10 @@
  • Derive statistical data for analytical purposes on system performance improvements. Entgra IoT - Server 3.4.0 will not keep any personal information after statistical calculations. Therefore, + Server 3.5.0 will not keep any personal information after statistical calculations. Therefore, the statistical report has no means of identifying an individual person.
  • -
  • Entgra IoT Server 3.4.0 may use:
  • +
  • Entgra IoT Server 3.5.0 may use:
    1. IP Address to derive geographic information
    2. @@ -126,28 +126,28 @@

Disclosure of personal information

-

Entgra IoT Server 3.4.0 only discloses personal information to the relevant applications (also known as - “Service Providers”) that are registered with Entgra IoT Server 3.4.0. These applications are +

Entgra IoT Server 3.5.0 only discloses personal information to the relevant applications (also known as + “Service Providers”) that are registered with Entgra IoT Server 3.5.0. These applications are registered by the identity administrator of your entity or organization. Personal information is disclosed only for the purposes for which it was collected (or for a use identified as consistent with that purpose) as controlled by such Service Providers, unless you have consented otherwise or where it is required by law.

Legal process

-

Please note that the organisation, entity or individual running Entgra IoT Server 3.4.0 may be +

Please note that the organisation, entity or individual running Entgra IoT Server 3.5.0 may be compelled to disclose your personal information with or without your consent when it is required by law following due and lawful process.

Storage of personal information

Where your personal information is stored

-

Entgra IoT Server 3.4.0 stores your personal information in secured databases. Entgra IoT Server 3.4.0 +

Entgra IoT Server 3.5.0 stores your personal information in secured databases. Entgra IoT Server 3.5.0 exercises proper industry accepted security measures to protect the database where your personal - information is held.Entgra IoT Server 3.4.0 as a product does not transfer or share your data with any + information is held.Entgra IoT Server 3.5.0 as a product does not transfer or share your data with any third parties or locations.

-

Entgra IoT Server 3.4.0 may use encryption to keep your personal data with an added level of +

Entgra IoT Server 3.5.0 may use encryption to keep your personal data with an added level of security.

How long your personal information is retained

-

Entgra IoT Server 3.4.0 retains your personal data as long as you are an active user of our system. You +

Entgra IoT Server 3.5.0 retains your personal data as long as you are an active user of our system. You can update your personal data at any time using the given self-care user portals.

-

Entgra IoT Server 3.4.0 may keep hashed secrets to provide you with an added level of security. This +

Entgra IoT Server 3.5.0 may keep hashed secrets to provide you with an added level of security. This includes:

  • Current password
  • @@ -157,15 +157,15 @@

    You can request the administrator to delete your account. The administrator is the administrator of the tenant you are registered under, or the super-administrator if you do not use the tenant feature.

    -

    Additionally, you can request to anonymize all traces of your activities that Entgra IoT Server 3.4.0 +

    Additionally, you can request to anonymize all traces of your activities that Entgra IoT Server 3.5.0 may have retained in logs, databases or analytical storage.

    More information

    Changes to this policy

    -

    Upgraded versions of Entgra IoT Server 3.4.0 may contain changes to this policy. Revisions to this +

    Upgraded versions of Entgra IoT Server 3.5.0 may contain changes to this policy. Revisions to this policy will be packaged within such upgrades and would only apply to users who choose to use upgraded versions.

    Your choices

    -

    If you are already have an user account within Entgra IoT Server 3.4.0 ; you have the right to +

    If you are already have an user account within Entgra IoT Server 3.5.0 ; you have the right to deactivate your account if you find that this privacy policy is unacceptable to you.

    If you do not have an account and you do not agree with our privacy policy, you can chose not to create one.

    @@ -174,19 +174,19 @@

    https://entgra.io.com/contact/

    Disclaimer

    Entgra, its employees, partners, and affiliates do not have access to and do not require, store, - process or control any of the data, including personal data contained in Entgra IoT Server 3.4.0. All + process or control any of the data, including personal data contained in Entgra IoT Server 3.5.0. All data, including personal data is controlled and processed by the entity or individual running Entgra - IoT Server 3.4.0. Entgra, its employees partners and affiliates are not a data processor or a data + IoT Server 3.5.0. Entgra, its employees partners and affiliates are not a data processor or a data controller within the meaning of any data privacy regulations. Entgra does not provide any warranties or undertake any responsibility or liability in connection with the lawfulness or the manner and - purposes for which Entgra IoT Server 3.4.0 is used by such entities or persons.

    + purposes for which Entgra IoT Server 3.5.0 is used by such entities or persons.

    This privacy policy is for the informational purposes of the entity or persons running Entgra IoT - Server 3.4.0 and sets out the processes and functionality contained within Entgra IoT Server 3.4.0 + Server 3.5.0 and sets out the processes and functionality contained within Entgra IoT Server 3.5.0 regarding personal data protection. It is the responsibility of entities and persons running Entgra IoT - Server 3.4.0 to create and administer its own rules and processes governing users’ personal data, + Server 3.5.0 to create and administer its own rules and processes governing users’ personal data, Please note that the creation of such rules and processes may change the use, storage and disclosure policies contained herein. Therefore users should consult the entity or persons running Entgra IoT - Server 3.4.0 for its own privacy policy for details governing users’ personal data.

    + Server 3.5.0 for its own privacy policy for details governing users’ personal data.

    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs index 48a23ed87e..ac4e28107d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.processing/processing.hbs @@ -46,7 +46,7 @@ {{#zone "topCss"}}