Merge branch 'cloud-3.1.0' of https://github.com/wso2/carbon-device-mgt into cloud-3.1.0

revert-70aa11f8
geethkokila 8 years ago
commit 71a689ea4b

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -93,7 +93,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
APIList apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0, tenantDomain, "tag:" + tag
, CONTENT_TYPE, null);
if (apiList.getList() != null && apiList.getList().size() == 0) {
if (apiList.getList() == null || apiList.getList().size() == 0) {
apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0
, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, "tag:" + tag, CONTENT_TYPE, null);
}

@ -21,13 +21,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description>

@ -14,13 +14,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.12-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>2.0.12-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -109,14 +109,11 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
} catch (UserStoreException e) {
log.error("Error while retrieving tenant admin user for the tenant domain"
+ PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(), e);
} catch (Throwable e) {
// This is done to stop tomcat failure if a webapp failed to publish apis.
log.error("Failed to Publish api from " + servletContext.getContextPath(), e);
}
}
}
}
//TODO : Need to implemented, to merge API Definitions in cases where implementation of an API Lies in two classes
private List<APIResourceConfiguration> mergeAPIDefinitions(List<APIResourceConfiguration> inputList) {
return null;
}
}

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -36,10 +36,10 @@
</Feature>
</Features>
<!-- <Sensors table-id="SAMPLE_DEVICE_2">
<Sensors table-id="SAMPLE_DEVICE_2">
<Sensor code="CPU_Temperature">
<Name>temperature sensor fitted</Name>
<StreamDefinition>org.wso2.temperature.stream<StreamDefinition>
<StreamDefinition>org.wso2.temperature.stream</StreamDefinition>
<Description>this is a sensor</Description>
<SensorStaticProperties>
<Property name="unit">celcius</Property>
@ -48,7 +48,7 @@
</Sensor>
<Sensor code="DHT11_Temperature">
<Name>temperature sensor fitted</Name>
<StreamDefinition>org.wso2.temperature.stream<StreamDefinition>
<StreamDefinition>org.wso2.temperature.stream</StreamDefinition>
<Description>this is a sensor</Description>
<SensorStaticProperties>
<Property name="unit">celcius</Property>
@ -57,7 +57,7 @@
<Property name="model_number"/>
</SensorDynamicProperties>
</Sensor>
</Sensors> -->
</Sensors>
<ProvisioningConfig>
<SharedWithAllTenants>false</SharedWithAllTenants>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -281,6 +281,11 @@
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.commons</groupId>
<artifactId>org.wso2.carbon.application.mgt.stub</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,148 @@
/*
* 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.device.mgt.jaxrs.service.api.admin;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "DeviceTypePublisherAdminService"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/admin/devicetype"),
})
}
),
tags = {
@Tag(name = "device_management", description = "")
}
)
@Path("/admin/devicetype")
@Api(value = "Devicetype deployment Administrative Service", description = "This an API intended to be used to " +
"deploy device type components" +
"Further, this is strictly restricted to admin users only ")
@Scopes(
scopes = {
@Scope(
name = "Devicetype deployment",
description = "Deploy devicetype",
key = "perm:devicetype:deployment",
permissions = {"/device-mgt/devicetype/deploy"}
)
}
)
public interface DeviceTypePublisherAdminService {
@POST
@Path("/deploy/{type}")
@ApiOperation(
httpMethod = "POST",
value = "Deploy device type\n",
notes = "This is an API that can be used to deploy existing device type artifact for tenant",
response = Response.class,
tags = "Devicetype Deployment Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:devicetype:deployment")
})
})
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "OK. \n Successfully deployed the artifacts.",
response = Response.class),
@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 = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while checking the authorization" +
" for a specified set of devices.",
response = ErrorResponse.class)
})
Response doPublish(
@ApiParam(name = "type",
value = "The type of deployment." +
"INFO: Deploy artifact with given type.",
required = true)
@PathParam("type") String type);
@GET
@Path("/deploy/{type}/status")
@ApiOperation(
httpMethod = "GET",
value = "Check the status of device type artifact\n",
notes = "This is an API that can be used to check the status of the artifact",
response = Response.class,
tags = "Devicetype Status Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:devicetype:deployment")
})
})
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "OK. \n Successfully deployed the artifacts.",
response = Response.class),
@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 = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while checking the authorization" +
" for a specified set of devices.",
response = ErrorResponse.class)
})
Response getStatus(@PathParam("type") String deviceType);
}

@ -0,0 +1,315 @@
/*
* 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.device.mgt.jaxrs.service.impl.admin;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.client.Options;
import org.apache.axis2.java.security.SSLProtocolSocketFactory;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.application.mgt.stub.upload.CarbonAppUploaderStub;
import org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem;
import org.wso2.carbon.base.ServerConfiguration;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.core.util.Utils;
import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceTypePublisherAdminService;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.ResourceImpl;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.utils.CarbonUtils;
import javax.activation.DataHandler;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import java.io.*;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
@Path("/admin/devicetype")
public class DeviceTypePublisherAdminServiceImpl implements DeviceTypePublisherAdminService {
/**
* required soap header for mutualSSL
*/
private static final String USER_NAME_HEADER = "UserName";
private static final String KEY_STORE_TYPE = "JKS";
/**
* Default truststore type of the client
*/
private static final String TRUST_STORE_TYPE = "JKS";
/**
* Default keymanager type of the client
*/
private static final String KEY_MANAGER_TYPE = "SunX509"; //Default Key Manager Type
/**
* Default trustmanager type of the client
*/
private static final String TRUST_MANAGER_TYPE = "SunX509"; //Default Trust Manager Type
private static final String SSLV3 = "SSLv3";
private KeyStore keyStore;
private KeyStore trustStore;
private char[] keyStorePassword;
private SSLContext sslContext;
private static final Log log = LogFactory.getLog(DeviceTypePublisherAdminServiceImpl.class);
private static final String DEFAULT_RESOURCE_LOCATION = "/resources/devicetypes";
private static final String CAR_FILE_LOCATION = CarbonUtils.getCarbonHome() + File.separator + "repository" +
File.separator + "resources" + File.separator + "devicetypes";
private static final String DAS_PORT = "${iot.analytics.https.port}";
private static final String DAS_HOST_NAME = "${iot.analytics.host}";
private static final String DEFAULT_HTTP_PROTOCOL = "https";
private static final String IOT_MGT_PORT = "${iot.manager.https.port}";
private static final String IOT_MGT_HOST_NAME = "${iot.manager.host}";
private static final String DAS_URL = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME
+ ":" + DAS_PORT + "/services/CarbonAppUploader" + "/";
private static final String IOT_MGT_URL = DEFAULT_HTTP_PROTOCOL + "://" + IOT_MGT_HOST_NAME
+ ":" + IOT_MGT_PORT + "/services/CarbonAppUploader" + "/";
private static final String MEDIA_TYPE_XML = "application/xml";
private static final String DEVICE_MANAGEMENT_TYPE = "device_management";
@Override
@POST
@Path("/deploy/{type}")
public Response doPublish(@PathParam("type") String type) {
try {
//Getting the tenant Domain
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
String tenantAdminUser = username + "@" + tenantDomain;
String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password");
String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty(
"Security.TrustStore.Password");
String keyStoreLocation = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Location");
String trustStoreLocation = ServerConfiguration.getInstance().getFirstProperty(
"Security.TrustStore.Location");
//Call to load the keystore.
loadKeyStore(keyStoreLocation, keyStorePassword);
//Call to load the TrustStore.
loadTrustStore(trustStoreLocation, trustStorePassword);
//Create the SSL context with the loaded TrustStore/keystore.
initMutualSSLConnection();
//Constructing the soap header that required for mutual SSL
String strHeader =
"<m:UserName soapenv:mustUnderstand=\"0\" xmlns:m=\"http://mutualssl.carbon.wso2.org\" " +
"xmlns:soapenv=\"http://www.w3.org/2001/12/soap-envelope\" >'" + tenantAdminUser +
"'</m:UserName>";
InputStream is = new ByteArrayInputStream(strHeader.getBytes());
OMElement header = OMXMLBuilderFactory.createOMBuilder(is).getDocumentElement();
List<Header> list = new ArrayList<Header>();
Header httpHeader = new Header();
httpHeader.setName(USER_NAME_HEADER);
byte[] encodedBytes = Base64.encodeBase64(tenantAdminUser.getBytes());
httpHeader.setValue(new String(encodedBytes));
list.add(httpHeader);//"https"
File directory = new File(CAR_FILE_LOCATION + File.separator + type);
if (directory.isDirectory() && directory.exists()) {
UploadedFileItem[] uploadedFileItems = loadCappFromFileSystem(type);
if (uploadedFileItems.length > 0) {
CarbonAppUploaderStub carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty(
IOT_MGT_URL));
carbonAppUploaderStub._getServiceClient().addHeader(header);
Options appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions();
if (appUploaderOptions == null) {
appUploaderOptions = new Options();
}
appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list);
appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER
, new Protocol(DEFAULT_HTTP_PROTOCOL, (ProtocolSocketFactory) new SSLProtocolSocketFactory
(sslContext), Integer.parseInt(Utils.replaceSystemProperty(IOT_MGT_PORT))));
carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions);
carbonAppUploaderStub.uploadApp(uploadedFileItems);
if (!DEVICE_MANAGEMENT_TYPE.equals(type.toLowerCase())) {
carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty(DAS_URL));
carbonAppUploaderStub._getServiceClient().addHeader(header);
appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions();
if (appUploaderOptions == null) {
appUploaderOptions = new Options();
}
appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list);
appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER
, new Protocol(DEFAULT_HTTP_PROTOCOL
, (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslContext)
, Integer.parseInt(Utils.replaceSystemProperty(DAS_PORT))));
carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions);
carbonAppUploaderStub.uploadApp(uploadedFileItems);
}
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
Registry registry = DeviceMgtAPIUtils.getRegistryService().getConfigSystemRegistry(tenantId);
if (!registry.resourceExists(DEFAULT_RESOURCE_LOCATION + type + ".exist")) {
Resource resource = new ResourceImpl();
resource.setContent("</exist>");
resource.setMediaType(MEDIA_TYPE_XML);
registry.put(DEFAULT_RESOURCE_LOCATION + type + ".exist", resource);
}
}
} else {
return Response.status(Response.Status.BAD_REQUEST)
.entity("\"Error, Artifact does not exist.\"").build();
}
} catch (Exception e) {
log.error("Capp deployment failed due to " + e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
"\"Error, Artifact deployment has failed\"").build();
}
return Response.status(Response.Status.CREATED).entity("\"OK. \\n Successfully uploaded the artifacts.\"")
.build();
}
@GET
@Path("/deploy/{type}/status")
@Override
public Response getStatus(@PathParam("type") String deviceType) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
Registry registry = null;
try {
registry = DeviceMgtAPIUtils.getRegistryService().getConfigSystemRegistry(tenantId);
if (registry.resourceExists(DEFAULT_RESOURCE_LOCATION + deviceType + ".exist")) {
return Response.status(Response.Status.OK).entity("Exist").build();
} else {
return Response.status(Response.Status.NO_CONTENT).entity("Does not Exist").build();
}
} catch (RegistryException e) {
log.error("Registry failed to load." + e.getMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
"\"Error, Artifact status check has failed\"").build();
}
}
private UploadedFileItem[] loadCappFromFileSystem(String deviceType) throws IOException {
File directory = new File(CAR_FILE_LOCATION + File.separator + deviceType);
File[] carFiles = directory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".car");
}
});
List<UploadedFileItem> uploadedFileItemLis = new ArrayList<>();
if (carFiles != null) {
for (File carFile : carFiles) {
UploadedFileItem uploadedFileItem = new UploadedFileItem();
DataHandler param = new DataHandler(carFile.toURI().toURL());
uploadedFileItem.setDataHandler(param);
uploadedFileItem.setFileName(carFile.getName());
uploadedFileItem.setFileType("jar");
uploadedFileItemLis.add(uploadedFileItem);
}
}
UploadedFileItem[] fileItems = new UploadedFileItem[uploadedFileItemLis.size()];
fileItems = uploadedFileItemLis.toArray(fileItems);
return fileItems;
}
/**
* Loads the keystore.
*
* @param keyStorePath - the path of the keystore
* @param ksPassword - the keystore password
*/
private void loadKeyStore(String keyStorePath, String ksPassword)
throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
InputStream fis = null;
try {
keyStorePassword = ksPassword.toCharArray();
keyStore = KeyStore.getInstance(KEY_STORE_TYPE);
fis = new FileInputStream(keyStorePath);
keyStore.load(fis, keyStorePassword);
} finally {
if (fis != null) {
fis.close();
}
}
}
/**
* Loads the trustore
*
* @param trustStorePath - the trustore path in the filesystem.
* @param tsPassword - the truststore password
*/
private void loadTrustStore(String trustStorePath, String tsPassword)
throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
InputStream fis = null;
try {
trustStore = KeyStore.getInstance(TRUST_STORE_TYPE);
fis = new FileInputStream(trustStorePath);
trustStore.load(fis, tsPassword.toCharArray());
} finally {
if (fis != null) {
fis.close();
}
}
}
/**
* Initializes the SSL Context
*/
private void initMutualSSLConnection() throws NoSuchAlgorithmException, UnrecoverableKeyException,
KeyStoreException, KeyManagementException {
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE);
keyManagerFactory.init(keyStore, keyStorePassword);
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE);
trustManagerFactory.init(trustStore);
// Create and initialize SSLContext for HTTPS communication
sslContext = SSLContext.getInstance(SSLV3);
sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
SSLContext.setDefault(sslContext);
}
}

@ -39,6 +39,7 @@ import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.InputValidationExcepti
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
@ -155,6 +156,18 @@ public class DeviceMgtAPIUtils {
return realmService;
}
public static RegistryService getRegistryService() {
RegistryService registryService;
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
registryService = (RegistryService) ctx.getOSGiService(RegistryService.class, null);
if (registryService == null) {
String msg = "registry service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
return registryService;
}
/**
* Getting the current tenant's user realm
*/

@ -39,6 +39,8 @@
<ref bean="groupManagementAdminService"/>
<ref bean="applicationManagementAdminService"/>
<ref bean="deviceTypeManagementAdminService"/>
<ref bean="deviceTypeManagementAdminService"/>
<ref bean="deviceTypePublisherAdminServiceImpl"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
@ -80,7 +82,9 @@
<bean id="userManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.UserManagementAdminServiceImpl"/>
<bean id="deviceTypeManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.DeviceTypeManagementServiceImpl"/>
<bean id="deviceAccessAuthorizationAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceAccessAuthorizationAdminServiceImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
<bean id="deviceTypePublisherAdminServiceImpl" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceTypePublisherAdminServiceImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
<!--<bean id="errorHandler" class="org.wso2.carbon.device.mgt.jaxrs.common.ErrorHandler"/>-->
<cxf:bus>

@ -21,7 +21,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -31,7 +31,7 @@
"issuer" : "devicemgt",
"appName" : "devicemgt",
"identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso",
"acs": "https://%iot.keymanager.host%:%iot.keymanager.https.port%/devicemgt/uuf/sso/acs",
"acs": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/uuf/sso/acs",
"identityAlias": "wso2carbon",
"responseSigningEnabled" : true,
"validateAssertionValidityPeriod": true,

@ -175,7 +175,8 @@
"perm:ios:remove-profile",
"perm:ios:get-restrictions",
"perm:ios:wipe-data",
"perm:admin"
"perm:admin",
"perm:devicetype:deployment"
],
"isOAuthEnabled" : true,
"backendRestEndpoints" : {

@ -26,7 +26,11 @@ var onFail;
var utility = require("/app/modules/utility.js").utility;
var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
if (context.input.samlToken) {
apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username + '@' + context.user.domain, context.input.samlToken);
//apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username + '@' + context.user.domain, context.input.samlToken);
/**
* Since the user can be verified using the sso.client.js we can use JWT grant type to issue the token for the user.
*/
apiWrapperUtil.setupTokenPairByJWTGrantType(context.user.username + '@' + context.user.domain, context.input.samlToken);
} else {
apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password);
}

@ -22,6 +22,7 @@ var utils = function () {
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js");
var carbon = require("carbon");
var authModule = require("/lib/modules/auth/auth.js").module;
//noinspection JSUnresolvedVariable
var Base64 = Packages.org.apache.commons.codec.binary.Base64;
@ -275,59 +276,34 @@ var utils = function () {
}
};
publicMethods["getTokenPairAndScopesBySAMLGrantType"] = function (assertion, encodedClientAppCredentials, scopes) {
if (!assertion || !encodedClientAppCredentials || !scopes) {
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by saml " +
"grant type. No assertion, encoded client app credentials or scopes are " +
"found - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
return null;
} else {
var assertionXML = publicMethods.decode(assertion);
/*
TODO: make assertion extraction with proper parsing.
Since Jaggery XML parser seem to add formatting which causes signature verification to fail.
*/
var assertionStartMarker = "<saml2:Assertion";
var assertionEndMarker = "<\/saml2:Assertion>";
var assertionStartIndex = assertionXML.indexOf(assertionStartMarker);
var assertionEndIndex = assertionXML.indexOf(assertionEndMarker);
var extractedAssertion;
if (assertionStartIndex == -1 || assertionEndIndex == -1) {
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access " +
"token by saml grant type. Issue in assertion format - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
return null;
} else {
extractedAssertion = assertionXML.
substring(assertionStartIndex, assertionEndIndex) + assertionEndMarker;
var encodedAssertion = publicMethods.encode(extractedAssertion);
// calling oauth provider token service endpoint
var requestURL = deviceMgtProps["oauthProvider"]["tokenServiceURL"];
var requestPayload = "grant_type=" + deviceMgtProps["oauthProvider"]["appRegistration"]["samlGrantTypeName"]
+ "&" + "assertion=" + encodeURIComponent(encodedAssertion) + "&scope=" + scopes;
var xhr = new XMLHttpRequest();
xhr.open("POST", requestURL, false);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Authorization", "Basic " + encodedClientAppCredentials);
xhr.send(requestPayload);
if (xhr["status"] == 200 && xhr["responseText"]) {
var responsePayload = parse(xhr["responseText"]);
var tokenData = {};
tokenData["accessToken"] = responsePayload["access_token"];
tokenData["refreshToken"] = responsePayload["refresh_token"];
tokenData["scopes"] = responsePayload["scope"];
return tokenData;
} else {
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token " +
"by password grant type - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
return null;
}
}
}
};
publicMethods["getTokenPairAndScopesByJWTGrantType"] = function (assertion, encodedClientAppCredentials, scopes) {
if (!assertion || !encodedClientAppCredentials || !scopes) {
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by jwt " +
"grant type. No assertion, encoded client app credentials or scopes are " +
"found - getTokenPairAndScopesByJWTGrantType(x, y, z)");
return null;
} else {
var ssoLoginUser = authModule.ssoLogin(assertion);
if (!ssoLoginUser.user.username) {
return null;
}
var endUsername = ssoLoginUser.user.username + "@" + ssoLoginUser.user.domain;
var JWTClientManagerServicePackagePath =
"org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService";
//noinspection JSUnresolvedFunction, JSUnresolvedVariable
var JWTClientManagerService = carbon.server.osgiService(JWTClientManagerServicePackagePath);
//noinspection JSUnresolvedFunction
var jwtClient = JWTClientManagerService.getJWTClient();
// returning access token by JWT grant type
var tokenInfo = jwtClient.getAccessToken(encodedClientAppCredentials,
endUsername, scopes);
var tokenData = {};
tokenData["accessToken"] = tokenInfo.getAccessToken();
tokenData["refreshToken"] = tokenInfo.getRefreshToken();
tokenData["scopes"] = tokenInfo.getScopes();
return tokenData;
}
};
publicMethods["getNewTokenPairByRefreshToken"] = function (refreshToken, encodedClientAppCredentials, scopes) {
if (!refreshToken || !encodedClientAppCredentials) {

@ -121,6 +121,51 @@ var handlers = function () {
}
};
publicMethods["setupTokenPairByJWTGrantType"] = function (username, samlToken) {
//samlToken is used to validate then if the user is a valid user then token is issued with JWT Grant Type.
if (!username || !samlToken) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " +
"saml grant type. Either username of logged in user, samlToken or both are missing " +
"as input - setupTokenPairBySamlGrantType(x, y)");
} else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
"by saml grant type. Encoded client credentials are " +
"missing - setupTokenPairBySamlGrantType(x, y)");
} else {
var tokenData;
var arrayOfScopes = devicemgtProps["scopes"];
arrayOfScopes = arrayOfScopes.concat(utility.getDeviceTypesScopesList());
var stringOfScopes = "";
arrayOfScopes.forEach(function (entry) {
stringOfScopes += entry + " ";
});
// accessTokenPair will include current access token as well as current refresh token
tokenData = tokenUtil.
getTokenPairAndScopesByJWTGrantType(samlToken, encodedClientAppCredentials, stringOfScopes);
if (!tokenData) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up token " +
"pair by password grant type. Error in token " +
"retrieval - setupTokenPairBySamlGrantType(x, y)");
} else {
var tokenPair = {};
tokenPair["accessToken"] = tokenData["accessToken"];
tokenPair["refreshToken"] = tokenData["refreshToken"];
// setting up access token pair into session context as a string
session.put(constants["TOKEN_PAIR"], stringify(tokenPair));
var scopes = tokenData.scopes.split(" ");
// adding allowed scopes to the session
session.put(constants["ALLOWED_SCOPES"], scopes);
}
}
}
};
publicMethods["refreshTokenPair"] = function () {
var currentTokenPair = parse(session.get(constants["TOKEN_PAIR"]));
// currentTokenPair includes current access token as well as current refresh token

@ -17,8 +17,8 @@
}}
{{#zone "footer"}}
<p>
<span class="hidden-xs">WSO2 Carbon Device Management Framework v2.0.6</span>
<span class="visible-xs-inline">WSO2 CDMF v2.0.6</span> | &copy; <script>document.write(new Date().getFullYear());</script>,
<span class="hidden-xs">WSO2 IoT Server 3.1.0</span>
<span class="visible-xs-inline">WSO2 IoT Server 3.1.0</span> | &copy; <script>document.write(new Date().getFullYear());</script>,
<a href="http://wso2.com/" target="_blank"><i class="icon fw fw-wso2"></i> Inc</a>. All Rights Reserved.
</p>
{{/zone}}

@ -21,7 +21,7 @@
<i class="fw fw-user fw-lg fw-helper fw-helper-inverse fw-helper-circle"></i>
<span class="hidden-xs add-padding-left-1x">
{{#if isSuperTenant }}
{{@user.username}} "SERVER" <span class="caret"></span>
{{@user.username}}<span class="caret"></span>
{{else}}
{{@user.username}}@{{@user.domain}} <span class="caret"></span>
{{/if}}
@ -120,4 +120,4 @@
{{#zone "bottomJs"}}
{{js "/js/user-menu.js"}}
{{/zone}}
{{/zone}}

@ -32,9 +32,29 @@
{{/if}}
{{#if permissions.VIEW_DASHBOARD}}
<li>
<a href="/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/">
<a href="javascript:statisticLoad('/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/')">
<i class="fw fw-bar-chart"></i>Device Statistics
</a>
<div id="statistic-response-template" style="display: none">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i id="status-icon" class="fw fw-error fw-stack-1x"></i>
</span>
<br>
</h3>
<h4>
<span id="title"></span>
<br>
</h4>
<span id="description"></span>
</div>
</div>
</div>
</div>
</li>
{{/if}}
{{#if permissions.LIST_GROUPS}}

@ -20,7 +20,7 @@ var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-content";
var emmAdminBasePath = "/api/device-mgt/v1.0";
var backendEndBasePath = "/api/device-mgt/v1.0";
/*
* set popup maximum height function.
@ -66,7 +66,7 @@ var updateNotificationCount = function (data, textStatus, jqXHR) {
function loadNotificationsPanel() {
if ("true" == $("#right-sidebar").attr("is-authorized")) {
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
var serviceURL = backendEndBasePath + "/notifications?status=NEW";
invokerUtil.get(serviceURL, updateNotificationCount, hideNotificationCount);
loadNewNotifications();
} else {
@ -90,7 +90,7 @@ function loadNewNotifications() {
var currentUser = notifications.data("currentUser");
$.template("notification-listing", notifications.attr("src"), function (template) {
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
var serviceURL = backendEndBasePath + "/notifications?status=NEW";
var successCallback = function (data, textStatus, jqXHR) {
if (jqXHR.status == 200 && data) {
@ -453,3 +453,44 @@ $(document).ready(function () {
});
}
});
function statisticLoad(redirectUrl) {
var contentType = "application/json";
var uri = backendEndBasePath + "/admin/devicetype/deploy/device_management/status";
var defaultStatusClasses = "fw fw-stack-1x";
var content = $("#statistic-response-template").find(".content");
var title = content.find("#title");
var statusIcon = content.find("#status-icon");
invokerUtil.get(uri, function (data, textStatus, jqXHR) {
if (jqXHR.status == 204) {
var urix = backendEndBasePath + "/admin/devicetype/deploy/device_management";
var device = {};
invokerUtil.post(urix, device, function (data) {
title.html("Deploying statistic artifacts. Please wait...");
statusIcon.attr("class", defaultStatusClasses + " fw-check");
$(modalPopupContent).html(content.html());
showPopup();
setTimeout(function () {
hidePopup();
// location.reload(true);
location.href = redirectUrl;
}, 20000);
}, function (jqXHR) {
title.html("Failed to deploy artifacts, Please contact administrator.");
statusIcon.attr("class", defaultStatusClasses + " fw-error");
$(modalPopupContent).html(content.html());
showPopup();
}, contentType);
} else {
location.href = redirectUrl;
}
}, function (jqXHR) {
title.html("Failed to connect with server, Please contact administrator.");
statusIcon.attr("class", defaultStatusClasses + " fw-error");
$(modalPopupContent).html(content.html());
showPopup();
}, contentType);
}

@ -565,6 +565,76 @@ var module = {};
}
};
/**
* saml token validation Service.
* @param request {Object} HTTP request
* @param response {Object} HTTP response
*/
module.ssoLogin = function (samlToken) {
var samlResponse = samlToken;
var ssoClient = require("sso").client;
var samlResponseObj;
if (samlResponse) {
try {
samlResponseObj = ssoClient.getSamlObject(samlResponse);
} catch (e) {
log.error(e.message, e);
return;
}
// This is a login response.
var ssoConfigs = getSsoConfigurations();
var CarbonUtils = Packages.org.wso2.carbon.utils.CarbonUtils;
var keyStorePassword = CarbonUtils.getServerConfiguration().getFirstProperty("Security.TrustStore.Password");
var keyStoreName = CarbonUtils.getServerConfiguration().getFirstProperty("Security.TrustStore.Location");
var identityAlias = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IDENTITY_ALIAS];
var keyStoreParams = {
KEY_STORE_NAME: keyStoreName,
KEY_STORE_PASSWORD: keyStorePassword,
IDP_ALIAS: identityAlias
};
var rsEnabled = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_RESPONSE_SIGNING_ENABLED];
if (utils.parseBoolean(rsEnabled)) {
if (!ssoClient.validateSignature(samlResponseObj, keyStoreParams)) {
var msg = "Invalid signature found in the SAML response.";
log.error(msg);
return;
}
}
if (!ssoClient.validateSamlResponse(samlResponseObj, ssoConfigs, keyStoreParams)) {
var msg = "Invalid SAML response found.";
log.error(msg);
return;
}
/**
* @type {{sessionId: string, loggedInUser: string, sessionIndex: string, samlToken:
* string}}
*/
var ssoSession = ssoClient.decodeSAMLLoginResponse(samlResponseObj, samlResponse,
session.getId());
if (ssoSession.sessionId) {
var ssoSessions = getSsoSessions();
ssoSessions[ssoSession.sessionId] = ssoSession;
if (ssoSession.sessionIndex) {
var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser);
utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId);
module.loadTenant(ssoSession.loggedInUser);
var user = {user: module.getCurrentUser()};
return user;
}
} else {
var msg = "Cannot decode SAML login response.";
log.error(msg);
return;
}
}
};
/**
* Load current user tenant
* @param username logged user name

@ -23,7 +23,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client registration service</name>
<description>WSO2 Carbon - Dynamic Client Registration Service</description>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.web.app.registration</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client web app registration</name>
<description>WSO2 Carbon - Dynamic Client Web-app Registration Service</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic client registration</name>
<url>http://wso2.org</url>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>
@ -58,6 +58,10 @@
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.user.mgt</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.oauth2.grant.jwt</artifactId>
</dependency>
</dependencies>
<build>
@ -83,6 +87,7 @@
org.wso2.carbon.device.mgt.oauth.extensions.*
</Export-Package>
<Import-Package>
org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}",
org.apache.commons.logging,
org.osgi.service.component,
org.wso2.carbon.identity.application.common.model;version="${carbon.identity.framework.version.range}",

@ -0,0 +1,61 @@
/*
* Copyright (c) 2016, 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.device.mgt.oauth.extensions.handlers.grant;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.keymgt.ScopesIssuer;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.grant.jwt.JWTBearerGrantHandler;
import org.wso2.carbon.identity.oauth2.model.RequestParameter;
import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
/**
* This sets up user with tenant aware username.
*/
@SuppressWarnings("unused")
public class ExtendedJWTGrantHandler extends JWTBearerGrantHandler {
private static Log log = LogFactory.getLog(ExtendedJWTGrantHandler.class);
private static final String TENANT_DOMAIN_KEY = "tenantDomain";
@Override
public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) {
return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx);
}
@Override
public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {
RequestParameter[] requestParameters = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getRequestParameters();
for (RequestParameter requestParameter : requestParameters) {
if (TENANT_DOMAIN_KEY.equals(requestParameter.getKey())) {
String[] values = requestParameter.getValue();
if (values != null && values.length > 0) {
tokReqMsgCtx.getOauth2AccessTokenReqDTO()
.setTenantDomain(values[0]);
}
}
}
return super.validateGrant(tokReqMsgCtx);
}
}

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -80,6 +80,25 @@ public class JWTClient {
return getTokenInfo(params, consumerKey, consumerSecret);
}
public AccessTokenInfo getAccessToken(String encodedAppcredential, String username, String scopes)
throws JWTClientException {
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair(JWTConstants.GRANT_TYPE_PARAM_NAME, jwtConfig.getJwtGrantType()));
String assertion = JWTClientUtil.generateSignedJWTAssertion(username, jwtConfig, isDefaultJWTClient);
if (assertion == null) {
throw new JWTClientException("JWT is not configured properly for user : " + username);
}
params.add(new BasicNameValuePair(JWTConstants.JWT_PARAM_NAME, assertion));
if (scopes != null && !scopes.isEmpty()) {
params.add(new BasicNameValuePair(JWTConstants.SCOPE_PARAM_NAME, scopes));
}
String decodedKey[] = getDecodedKey(encodedAppcredential);
if (decodedKey.length != 2) {
throw new JWTClientException("Invalid app credential");
}
return getTokenInfo(params, decodedKey[0], decodedKey[1]);
}
public AccessTokenInfo getAccessToken(String consumerKey, String consumerSecret, String username, String scopes,
Map<String, String> paramsMap)
throws JWTClientException {
@ -137,9 +156,12 @@ public class JWTClient {
String accessToken = (String) jsonObject.get(JWTConstants.ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME);
if (accessToken != null && !accessToken.isEmpty()) {
accessTokenInfo.setAccessToken(accessToken);
accessTokenInfo.setRefreshToken((String) jsonObject.get(JWTConstants.REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME));
accessTokenInfo.setRefreshToken((String) jsonObject.get(
JWTConstants.REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME));
accessTokenInfo.setExpiresIn((Long) jsonObject.get(JWTConstants.OAUTH_EXPIRES_IN));
accessTokenInfo.setTokenType((String) jsonObject.get(JWTConstants.OAUTH_TOKEN_TYPE));
accessTokenInfo.setScopes((String) jsonObject.get(JWTConstants.OAUTH_TOKEN_SCOPE));
}
return accessTokenInfo;
} catch (MalformedURLException e) {
@ -161,7 +183,11 @@ public class JWTClient {
return new String(Base64.encodeBase64((consumerKey + ":" + consumerSecret).getBytes()));
}
public String getJwtToken(String username) throws JWTClientException {
private String[] getDecodedKey(String encodedKey) {
return (new String(Base64.decodeBase64((encodedKey).getBytes()))).split(":");
}
public String getJwtToken(String username) throws JWTClientException {
return JWTClientUtil.generateSignedJWTAssertion(username, jwtConfig, isDefaultJWTClient);
}

@ -23,6 +23,7 @@ package org.wso2.carbon.identity.jwt.client.extension.constant;
public class JWTConstants {
public static final String OAUTH_EXPIRES_IN = "expires_in";
public static final String OAUTH_TOKEN_TYPE = "token_type";
public static final String OAUTH_TOKEN_SCOPE = "scope";
public static final String JWT_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer";
public static final String GRANT_TYPE_PARAM_NAME = "grant_type";
public static final String REFRESH_TOKEN_GRANT_TYPE = "refresh_token";

@ -27,6 +27,7 @@ public class AccessTokenInfo {
private long expiresIn;
private String refreshToken;
private String accessToken;
private String scopes;
public String getTokenType() {
return tokenType;
@ -59,4 +60,12 @@ public class AccessTokenInfo {
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getScopes() {
return scopes;
}
public void setScopes(String scopes) {
this.scopes = scopes;
}
}

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.decision.point</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the handler for the api authentications

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.12-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<version>2.0.12-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Type Deployer Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - Device Type Deployer Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - GCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,13 +3,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard.feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management Dashboard Analytics Feature</name>
<description>WSO2 Carbon - Device Management Dashboard Analytics Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -28,8 +28,8 @@
<PushNotificationProviders>
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.GCMBasedPushNotificationProvider</Provider>
<!--<Provider>org.wso2.carbon.device.mgt.mobile.impl.ios.apns.APNSBasedPushNotificationProvider</Provider>-->
<!--<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider</Provider>-->
<!--<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider</Provider>-->
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider</Provider>
<Provider>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider</Provider>
</PushNotificationProviders>
<IdentityConfiguration>
<ServerUrl>https://localhost:9443</ServerUrl>
@ -47,11 +47,6 @@
<!--Simple -> Simple policy evaluation point-->
<!--Merged -> Merged policy evaluation point -->
<PolicyEvaluationPoint>Simple</PolicyEvaluationPoint>
<Platforms>
<Platform>android</Platform>
<Platform>ios</Platform>
<Platform>windows</Platform>
</Platforms>
</PolicyConfiguration>
<!--<TaskConfiguration>-->
<!--<Enable>true</Enable>-->

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Dynamic Client Registration Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains dynamic client registration features</description>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic Client Registration Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.email.sender.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for email sender related functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>jwt-client-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.jwt.client.extension.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - JWT Client Feature</name>
<url>http://wso2.org</url>
<description>This feature contains jwt client implementation from which we can get a access token using the jwt

@ -19,7 +19,7 @@
#issuer of the JWT
iss=wso2.org/products/iot
TokenEndpoint=https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token
TokenEndpoint=https://${iot.gateway.host}:${iot.gateway.https.port}/token?tenantDomain=carbon.super
#audience of JWT claim
#comma seperated values

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jwt-client-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic Client Registration Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Device Mgt OAuth Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains devicemgt related OAuth extensions</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management OAuth Extensions Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.policy.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Policy Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework-feature</artifactId>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.webapp.authenticator.framework.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.15-SNAPSHOT</version>
<version>2.0.16-SNAPSHOT</version>
<name>WSO2 Carbon - Webapp Authenticator Framework Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save