mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of ssh://repository.entgra.net:222/community/device-mgt-core
This commit is contained in:
commit
c3abf3d6b7
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>analytics-mgt</artifactId>
|
<artifactId>analytics-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@ -0,0 +1,153 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2023, Entgra (Pvt) Ltd. (http://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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>io.entgra.device.mgt.core.apimgt.extension.rest.api</artifactId>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<name>Entgra - Device Management Extension for APIM REST API</name>
|
||||||
|
<description>Entgra - Device Management Extension for APIM REST API</description>
|
||||||
|
<url>https://entgra.io</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json.wso2</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.apimgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>5.1.7</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>Publisher API Management Bundle</Bundle-Description>
|
||||||
|
<Private-Package>
|
||||||
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.internal
|
||||||
|
</Private-Package>
|
||||||
|
<Export-Package>
|
||||||
|
!io.entgra.device.mgt.core.apimgt.extension.rest.api.internal,
|
||||||
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.*
|
||||||
|
</Export-Package>
|
||||||
|
<Import-Package>
|
||||||
|
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
|
||||||
|
org.osgi.service.*;version="${imp.package.version.osgi.service}",
|
||||||
|
org.wso2.carbon.core;version="4.6",
|
||||||
|
org.wso2.carbon.core.util;version="4.6",
|
||||||
|
org.apache.commons.ssl,
|
||||||
|
org.wso2.carbon.apimgt.api.model,
|
||||||
|
okhttp3.*,
|
||||||
|
org.wso2.carbon.apimgt.impl;version="${carbon.api.mgt.version.range}",
|
||||||
|
org.wso2.carbon.apimgt.impl.utils;version="${carbon.api.mgt.version.range}",
|
||||||
|
org.wso2.carbon.apimgt.impl.internal;version="${carbon.api.mgt.version.range}",
|
||||||
|
org.json
|
||||||
|
</Import-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>jacoco-initialize</id>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>jacoco-site</id>
|
||||||
|
<phase>test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
|
||||||
|
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
|
||||||
|
|
||||||
|
public interface APIApplicationServices {
|
||||||
|
|
||||||
|
APIApplicationKey createAndRetrieveApplicationCredentials() throws APIServicesException;
|
||||||
|
|
||||||
|
AccessTokenInfo generateAccessTokenFromRegisteredApplication(String clientId, String clientSecret) throws APIServicesException;
|
||||||
|
|
||||||
|
AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String clientId, String clientSecret) throws APIServicesException;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Credentials;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.apimgt.impl.APIManagerConfiguration;
|
||||||
|
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class APIApplicationServicesImpl implements APIApplicationServices {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(APIApplicationServicesImpl.class);
|
||||||
|
private static final OkHttpClient client = new OkHttpClient(HttpsTrustManagerUtils.getSSLClient().newBuilder());
|
||||||
|
private static final Gson gson = new Gson();
|
||||||
|
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||||
|
String msg = null;
|
||||||
|
APIManagerConfiguration config = ServiceReferenceHolder.getInstance().
|
||||||
|
getAPIManagerConfigurationService().getAPIManagerConfiguration();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public APIApplicationKey createAndRetrieveApplicationCredentials()
|
||||||
|
throws APIServicesException {
|
||||||
|
|
||||||
|
String applicationEndpoint = config.getFirstProperty(Constants.DCR_END_POINT);
|
||||||
|
String serverUser = config.getFirstProperty(Constants.SERVER_USER);
|
||||||
|
String serverPassword = config.getFirstProperty(Constants.SERVER_PASSWORD);
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("callbackUrl", Constants.EMPTY_STRING);
|
||||||
|
jsonObject.put("clientName", Constants.CLIENT_NAME);
|
||||||
|
jsonObject.put("grantType", Constants.GRANT_TYPE);
|
||||||
|
jsonObject.put("owner", serverUser);
|
||||||
|
jsonObject.put("saasApp", true);
|
||||||
|
|
||||||
|
RequestBody requestBody = RequestBody.Companion.create(jsonObject.toString(), JSON);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(applicationEndpoint)
|
||||||
|
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Credentials.basic(serverUser, serverPassword))
|
||||||
|
.post(requestBody)
|
||||||
|
.build();
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
return gson.fromJson(response.body().string(), APIApplicationKey.class);
|
||||||
|
} catch (IOException e) {
|
||||||
|
msg = "Error occurred while processing the response";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new APIServicesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessTokenInfo generateAccessTokenFromRegisteredApplication(String consumerKey, String consumerSecret)
|
||||||
|
throws APIServicesException {
|
||||||
|
|
||||||
|
String userName = config.getFirstProperty(Constants.SERVER_USER);
|
||||||
|
String userPassword = config.getFirstProperty(Constants.SERVER_PASSWORD);
|
||||||
|
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
params.put(Constants.GRANT_TYPE_PARAM_NAME, Constants.PASSWORD_GRANT_TYPE);
|
||||||
|
params.put(Constants.PASSWORD_GRANT_TYPE_USERNAME, userName);
|
||||||
|
params.put(Constants.PASSWORD_GRANT_TYPE_PASSWORD, userPassword);
|
||||||
|
params.put(Constants.SCOPE_PARAM_NAME, Constants.SCOPES);
|
||||||
|
return getToken(params, consumerKey, consumerSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String consumerKey, String consumerSecret)
|
||||||
|
throws APIServicesException {
|
||||||
|
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
params.put(Constants.GRANT_TYPE_PARAM_NAME, Constants.REFRESH_TOKEN_GRANT_TYPE);
|
||||||
|
params.put(Constants.REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME, refreshToken);
|
||||||
|
params.put(Constants.SCOPE_PARAM_NAME, Constants.SCOPES);
|
||||||
|
return getToken(params, consumerKey, consumerSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccessTokenInfo getToken(JSONObject nameValuePairs, String clientId, String clientSecret)
|
||||||
|
throws APIServicesException {
|
||||||
|
|
||||||
|
String tokenEndPoint = config.getFirstProperty(Constants.TOKE_END_POINT);
|
||||||
|
|
||||||
|
RequestBody requestBody = RequestBody.Companion.create(nameValuePairs.toString(), JSON);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(tokenEndPoint)
|
||||||
|
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Credentials.basic(clientId, clientSecret))
|
||||||
|
.post(requestBody)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
return gson.fromJson(response.body().string(), AccessTokenInfo.class);
|
||||||
|
} catch (IOException e) {
|
||||||
|
msg = "Error occurred while processing the response";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new APIServicesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.wso2.carbon.apimgt.api.model.Scope;
|
||||||
|
|
||||||
|
public interface PublisherRESTAPIServices {
|
||||||
|
|
||||||
|
JSONObject getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException;
|
||||||
|
|
||||||
|
boolean isSharedScopeNameExists(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String key)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException;
|
||||||
|
|
||||||
|
boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException;
|
||||||
|
}
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.commons.ssl.Base64;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.wso2.carbon.apimgt.api.model.Scope;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class PublisherRESTAPIServicesImpl implements PublisherRESTAPIServices {
|
||||||
|
private static final Log log = LogFactory.getLog(PublisherRESTAPIServicesImpl.class);
|
||||||
|
private static final OkHttpClient client = new OkHttpClient(HttpsTrustManagerUtils.getSSLClient().newBuilder());
|
||||||
|
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||||
|
private static final String host = System.getProperty(Constants.IOT_CORE_HOST);
|
||||||
|
private static final String port = System.getProperty(Constants.IOT_CORE_HTTPS_PORT);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException {
|
||||||
|
|
||||||
|
String getAllScopesUrl = Constants.HTTPS_PROTOCOL + Constants.SCHEME_SEPARATOR + host + Constants.COLON
|
||||||
|
+ port + Constants.GET_ALL_SCOPES;
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(getAllScopesUrl)
|
||||||
|
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
|
||||||
|
+ accessTokenInfo.getAccess_token())
|
||||||
|
.get()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (HttpStatus.SC_OK == response.code()) {
|
||||||
|
JSONObject jsonObject = new JSONObject(response.body().string());
|
||||||
|
return jsonObject;
|
||||||
|
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
|
||||||
|
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
|
||||||
|
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
|
||||||
|
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
|
||||||
|
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
|
||||||
|
//TODO: max attempt count
|
||||||
|
return getScopes(apiApplicationKey, refreshedAccessToken);
|
||||||
|
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
|
||||||
|
String msg = "Bad Request, Invalid request";
|
||||||
|
log.error(msg);
|
||||||
|
throw new BadRequestException(msg);
|
||||||
|
} else {
|
||||||
|
String msg = "Response : " + response.code() + response.body();
|
||||||
|
throw new UnexpectedResponseException(msg);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
String msg = "Error occurred while processing the response";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new APIServicesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSharedScopeNameExists(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String key)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException {
|
||||||
|
|
||||||
|
String keyValue = new String(Base64.encodeBase64((key).getBytes())).replace(Constants.QUERY_KEY_VALUE_SEPARATOR,
|
||||||
|
Constants.EMPTY_STRING);
|
||||||
|
String getScopeUrl = Constants.HTTPS_PROTOCOL + Constants.SCHEME_SEPARATOR + host + Constants.COLON
|
||||||
|
+ port + Constants.GET_SCOPE + keyValue;
|
||||||
|
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(getScopeUrl)
|
||||||
|
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
|
||||||
|
+ accessTokenInfo.getAccess_token())
|
||||||
|
.head()
|
||||||
|
.build();
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (HttpStatus.SC_OK == response.code()) {
|
||||||
|
return true;
|
||||||
|
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
|
||||||
|
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
|
||||||
|
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
|
||||||
|
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
|
||||||
|
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
|
||||||
|
//TODO: max attempt count
|
||||||
|
return isSharedScopeNameExists(apiApplicationKey, refreshedAccessToken, key);
|
||||||
|
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
|
||||||
|
String msg = "Bad Request, Invalid request";
|
||||||
|
log.error(msg);
|
||||||
|
throw new BadRequestException(msg);
|
||||||
|
} else {
|
||||||
|
String msg = "Response : " + response.code() + response.body();
|
||||||
|
throw new UnexpectedResponseException(msg);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
String msg = "Error occurred while processing the response";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new APIServicesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope)
|
||||||
|
throws APIServicesException, BadRequestException, UnexpectedResponseException {
|
||||||
|
|
||||||
|
String updateScopeUrl = Constants.HTTPS_PROTOCOL + Constants.SCHEME_SEPARATOR + host
|
||||||
|
+ Constants.COLON + port + Constants.GET_SCOPE + scope.getId();
|
||||||
|
|
||||||
|
ScopeUtils scopeUtil = new ScopeUtils();
|
||||||
|
scopeUtil.setKey(scope.getKey());
|
||||||
|
scopeUtil.setName(scope.getName());
|
||||||
|
scopeUtil.setDescription(scope.getDescription());
|
||||||
|
scopeUtil.setRoles(scope.getRoles());
|
||||||
|
String scopeString = scopeUtil.toJSON();
|
||||||
|
|
||||||
|
RequestBody requestBody = RequestBody.create(JSON, scopeString);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(updateScopeUrl)
|
||||||
|
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
|
||||||
|
+ accessTokenInfo.getAccess_token())
|
||||||
|
.put(requestBody)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (HttpStatus.SC_OK == response.code()) {
|
||||||
|
return true;
|
||||||
|
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
|
||||||
|
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
|
||||||
|
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
|
||||||
|
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
|
||||||
|
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
|
||||||
|
//TODO: max attempt count
|
||||||
|
return updateSharedScope(apiApplicationKey, refreshedAccessToken, scope);
|
||||||
|
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
|
||||||
|
String msg = "Bad Request, Invalid scope object";
|
||||||
|
log.error(msg);
|
||||||
|
throw new BadRequestException(msg);
|
||||||
|
} else {
|
||||||
|
String msg = "Response : " + response.code() + response.body();
|
||||||
|
throw new UnexpectedResponseException(msg);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
String msg = "Error occurred while processing the response";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new APIServicesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the data that are required to register
|
||||||
|
* the oauth application.
|
||||||
|
*/
|
||||||
|
public class RegistrationProfile {
|
||||||
|
|
||||||
|
private String callbackUrl;
|
||||||
|
private String clientName;
|
||||||
|
private String tokenScope;
|
||||||
|
private String owner;
|
||||||
|
private String grantType;
|
||||||
|
private String applicationType;
|
||||||
|
private boolean isSaasApp;
|
||||||
|
|
||||||
|
private static final String TAG = RegistrationProfile.class.getSimpleName();
|
||||||
|
|
||||||
|
public String getCallbackUrl() {
|
||||||
|
return callbackUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallbackUrl(String callBackUrl) {
|
||||||
|
this.callbackUrl = callBackUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientName() {
|
||||||
|
return clientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientName(String clientName) {
|
||||||
|
this.clientName = clientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTokenScope() {
|
||||||
|
return tokenScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenScope(String tokenScope) {
|
||||||
|
this.tokenScope = tokenScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGrantType() {
|
||||||
|
return grantType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrantType(String grantType) {
|
||||||
|
this.grantType = grantType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationType() {
|
||||||
|
return applicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationType(String applicationType) {
|
||||||
|
this.applicationType = applicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSaasApp() {
|
||||||
|
return isSaasApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSaasApp(boolean isSaasApp) {
|
||||||
|
this.isSaasApp = isSaasApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() {
|
||||||
|
String jsonString =
|
||||||
|
"{\"callbackUrl\": \"" + callbackUrl + "\",\"clientName\": \"" + clientName +
|
||||||
|
"\", \"owner\": \"" + owner + "\"," + "\"grantType\": \"" + grantType +
|
||||||
|
"\", \"saasApp\" : " + isSaasApp + " }\n";
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.constants;
|
||||||
|
|
||||||
|
public final class Constants {
|
||||||
|
|
||||||
|
private Constants() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String EMPTY_STRING = "";
|
||||||
|
public static final String CLIENT_NAME = "rest_api_publisher_code";
|
||||||
|
public static final String SERVER_USER = "WorkflowConfigurations.ServerUser";
|
||||||
|
public static final String SERVER_PASSWORD = "WorkflowConfigurations.ServerPassword";
|
||||||
|
public static final String GRANT_TYPE = "client_credentials password refresh_token";
|
||||||
|
public static final String REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME = "refresh_token";
|
||||||
|
public static final String OAUTH_EXPIRES_IN = "expires_in";
|
||||||
|
public static final String OAUTH_TOKEN_SCOPE = "scope";
|
||||||
|
public static final String OAUTH_TOKEN_TYPE = "token_type";
|
||||||
|
public static final String REFRESH_TOKEN_GRANT_TYPE = "refresh_token";
|
||||||
|
public static final String SCOPE_PARAM_NAME = "scope";
|
||||||
|
public static final String SCOPES = "apim:api_create apim:api_view apim:shared_scope_manage";
|
||||||
|
public static final String DCR_END_POINT = "WorkflowConfigurations.DCREndPoint";
|
||||||
|
public static final String TOKE_END_POINT = "WorkflowConfigurations.TokenEndPoint";
|
||||||
|
public static final String ADAPTER_CONF_KEEP_ALIVE = "keepAlive";
|
||||||
|
public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000;
|
||||||
|
public static final String CLIENT_ID = "clientId";
|
||||||
|
public static final String CLIENT_SECRET = "clientSecret";
|
||||||
|
|
||||||
|
public static final String AUTHORIZATION_HEADER_NAME = "Authorization";
|
||||||
|
public static final String AUTHORIZATION_HEADER_VALUE_PREFIX = "Basic ";
|
||||||
|
public static final String AUTHORIZATION_HEADER_PREFIX_BEARER = "Bearer ";
|
||||||
|
public static final String HEADER_CONTENT_TYPE = "Content-Type";
|
||||||
|
public static final String APPLICATION_JSON = "application/json";
|
||||||
|
public static final String PASSWORD_GRANT_TYPE = "password";
|
||||||
|
public static final String PASSWORD_GRANT_TYPE_USERNAME = "username";
|
||||||
|
public static final String PASSWORD_GRANT_TYPE_PASSWORD = "password";
|
||||||
|
public static final String PASSWORD_GRANT_TYPE_SCOPES = "scopes";
|
||||||
|
public static final String ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME = "access_token";
|
||||||
|
public static final String GRANT_TYPE_PARAM_NAME = "grant_type";
|
||||||
|
public static final String HTTPS_PROTOCOL = "https";
|
||||||
|
public static final String HTTP_PROTOCOL = "http";
|
||||||
|
public static final String SCHEME_SEPARATOR = "://";
|
||||||
|
public static final String COLON = ":";
|
||||||
|
public static final String QUERY_KEY_VALUE_SEPARATOR = "=";
|
||||||
|
public static final String IOT_CORE_HOST = "iot.core.host";
|
||||||
|
public static final String IOT_CORE_HTTPS_PORT = "iot.core.https.port";
|
||||||
|
public static final String GET_ALL_SCOPES = "/api/am/publisher/v2/scopes?limit=1000";
|
||||||
|
public static final String GET_SCOPE = "/api/am/publisher/v2/scopes/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This holds the consumer application information that return from the register application endpoint
|
||||||
|
*/
|
||||||
|
public class APIApplicationKey {
|
||||||
|
private String clientName;
|
||||||
|
private String clientId;
|
||||||
|
private String clientSecret;
|
||||||
|
private String callBackURL;
|
||||||
|
private String isSaasApplication;
|
||||||
|
private String appOwner;
|
||||||
|
private String jsonString;
|
||||||
|
private String jsonAppAttribute;
|
||||||
|
private String tokenType;
|
||||||
|
|
||||||
|
public APIApplicationKey(String clientId, String clientSecret) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
this.clientSecret = clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientId(String clientId) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientSecret() {
|
||||||
|
return clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientSecret(String clientSecret) {
|
||||||
|
this.clientSecret = clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientName() {
|
||||||
|
return clientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientName(String clientName) {
|
||||||
|
this.clientName = clientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCallBackURL() {
|
||||||
|
return callBackURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallBackURL(String callBackURL) {
|
||||||
|
this.callBackURL = callBackURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsSaasApplication() {
|
||||||
|
return isSaasApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSaasApplication(String isSaasApplication) {
|
||||||
|
this.isSaasApplication = isSaasApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppOwner() {
|
||||||
|
return appOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppOwner(String appOwner) {
|
||||||
|
this.appOwner = appOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJsonString() {
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJsonString(String jsonString) {
|
||||||
|
this.jsonString = jsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJsonAppAttribute() {
|
||||||
|
return jsonAppAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJsonAppAttribute(String jsonAppAttribute) {
|
||||||
|
this.jsonAppAttribute = jsonAppAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTokenType() {
|
||||||
|
return tokenType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenType(String tokenType) {
|
||||||
|
this.tokenType = tokenType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This holds the token information that return from the token endpoint.
|
||||||
|
*/
|
||||||
|
public class AccessTokenInfo {
|
||||||
|
|
||||||
|
private String token_type;
|
||||||
|
private long expires_in;
|
||||||
|
private String refresh_token;
|
||||||
|
private String access_token;
|
||||||
|
private String scope;
|
||||||
|
|
||||||
|
public String getToken_type() {
|
||||||
|
return token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken_type(String token_type) {
|
||||||
|
this.token_type = token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExpires_in() {
|
||||||
|
return expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpires_in(long expires_in) {
|
||||||
|
this.expires_in = expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefresh_token() {
|
||||||
|
return refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefresh_token(String refresh_token) {
|
||||||
|
this.refresh_token = refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccess_token() {
|
||||||
|
return access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccess_token(String access_token) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;
|
||||||
|
|
||||||
|
public class APIServicesException extends Exception {
|
||||||
|
|
||||||
|
public APIServicesException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIServicesException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIServicesException(String message, Throwable cause) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIServicesException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom exception class for handling bad request exceptions.
|
||||||
|
*/
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;
|
||||||
|
|
||||||
|
public class BadRequestException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2387103750774855056L;
|
||||||
|
|
||||||
|
public BadRequestException(String errorMessage) {
|
||||||
|
super(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom exception class for handling unexpected server response exceptions.
|
||||||
|
*/
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;
|
||||||
|
|
||||||
|
public class UnexpectedResponseException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2387103750774855056L;
|
||||||
|
|
||||||
|
public UnexpectedResponseException(String errorMessage) {
|
||||||
|
super(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.internal;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices;
|
||||||
|
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
|
||||||
|
|
||||||
|
public class PublisherRESTAPIDataHolder {
|
||||||
|
|
||||||
|
private APIApplicationServices apiApplicationServices;
|
||||||
|
private APIManagerConfigurationService apiManagerConfigurationService;
|
||||||
|
|
||||||
|
private static PublisherRESTAPIDataHolder thisInstance = new PublisherRESTAPIDataHolder();
|
||||||
|
|
||||||
|
private PublisherRESTAPIDataHolder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static PublisherRESTAPIDataHolder getInstance() {
|
||||||
|
return thisInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIApplicationServices getApiApplicationServices() {
|
||||||
|
return apiApplicationServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiApplicationServices(APIApplicationServices apiApplicationServices) {
|
||||||
|
this.apiApplicationServices = apiApplicationServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAPIManagerConfiguration(APIManagerConfigurationService apiManagerConfigurationService) {
|
||||||
|
this.apiManagerConfigurationService = apiManagerConfigurationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public APIManagerConfigurationService getAPIManagerConfigurationService() {
|
||||||
|
if (apiManagerConfigurationService == null) {
|
||||||
|
throw new IllegalStateException("API Manager Configuration service is not initialized properly");
|
||||||
|
}
|
||||||
|
return apiManagerConfigurationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.internal;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.service.component.ComponentContext;
|
||||||
|
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @scr.component name="internal.io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServiceComponent"
|
||||||
|
* immediate="true"
|
||||||
|
* @scr.reference name="user.apimanagerconfigurationservice.default"
|
||||||
|
* interface="org.wso2.carbon.apimgt.impl.APIManagerConfigurationService"
|
||||||
|
* cardinality="1..1"
|
||||||
|
* policy="dynamic"
|
||||||
|
* bind="setAPIManagerConfigurationService"
|
||||||
|
* unbind="unsetAPIManagerConfigurationService"
|
||||||
|
*/
|
||||||
|
public class PublisherRESTAPIServiceComponent {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(PublisherRESTAPIServiceComponent.class);
|
||||||
|
|
||||||
|
protected void activate(ComponentContext componentContext) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Initializing publisher API extension bundle");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
BundleContext bundleContext = componentContext.getBundleContext();
|
||||||
|
|
||||||
|
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
|
||||||
|
bundleContext.registerService(APIApplicationServices.class.getName(), apiApplicationServices, null);
|
||||||
|
PublisherRESTAPIDataHolder.getInstance().setApiApplicationServices(apiApplicationServices);
|
||||||
|
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("API Application bundle has been successfully initialized");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error occurred while initializing API Application bundle", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void deactivate(ComponentContext componentContext) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAPIManagerConfigurationService(APIManagerConfigurationService apiManagerConfigurationService) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Setting API Manager Configuration Service");
|
||||||
|
}
|
||||||
|
PublisherRESTAPIDataHolder.getInstance().setAPIManagerConfiguration(apiManagerConfigurationService);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService apiManagerConfigurationService) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Unsetting API Manager Configuration Service");
|
||||||
|
}
|
||||||
|
PublisherRESTAPIDataHolder.getInstance().setAPIManagerConfiguration(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.util;
|
||||||
|
|
||||||
|
import okhttp3.ConnectionPool;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.base.ServerConfiguration;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.net.ProxySelector;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.SocketAddress;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.KeyStoreException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.UnrecoverableKeyException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class HttpsTrustManagerUtils {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(HttpsTrustManagerUtils.class);
|
||||||
|
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 static final String DEFAULT_HOST = "localhost";
|
||||||
|
private static final String DEFAULT_HOST_IP = "127.0.0.1";
|
||||||
|
private static final int TIMEOUT = 100;
|
||||||
|
|
||||||
|
public static OkHttpClient getSSLClient() {
|
||||||
|
|
||||||
|
boolean isIgnoreHostnameVerification = Boolean.parseBoolean(System.getProperty("org.wso2"
|
||||||
|
+ ".ignoreHostnameVerification"));
|
||||||
|
OkHttpClient okHttpClient;
|
||||||
|
final String proxyHost = System.getProperty("http.proxyHost");
|
||||||
|
final String proxyPort = System.getProperty("http.proxyPort");
|
||||||
|
final String nonProxyHostsValue = System.getProperty("http.nonProxyHosts");
|
||||||
|
|
||||||
|
final ProxySelector proxySelector = new ProxySelector() {
|
||||||
|
@Override
|
||||||
|
public List<Proxy> select(URI uri) {
|
||||||
|
List<Proxy> proxyList = new ArrayList<>();
|
||||||
|
String host = uri.getHost();
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(host)) {
|
||||||
|
if (host.startsWith(DEFAULT_HOST_IP) || host.startsWith(DEFAULT_HOST) || StringUtils
|
||||||
|
.isEmpty(nonProxyHostsValue) || StringUtils.contains(nonProxyHostsValue, host) ||
|
||||||
|
StringUtils.isEmpty(proxyHost) || StringUtils.isEmpty(proxyPort)) {
|
||||||
|
proxyList.add(Proxy.NO_PROXY);
|
||||||
|
} else {
|
||||||
|
proxyList.add(new Proxy(Proxy.Type.HTTP,
|
||||||
|
new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort))));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("Host is null. Host could not be empty or null");
|
||||||
|
}
|
||||||
|
return proxyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
X509TrustManager trustAllCerts = new X509TrustManager() {
|
||||||
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new java.security.cert.X509Certificate[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkClientTrusted(
|
||||||
|
java.security.cert.X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkServerTrusted(
|
||||||
|
java.security.cert.X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isIgnoreHostnameVerification) {
|
||||||
|
okHttpClient = new OkHttpClient.Builder()
|
||||||
|
.connectTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.writeTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.readTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.connectionPool(new ConnectionPool(TIMEOUT, TIMEOUT, TimeUnit.SECONDS))
|
||||||
|
.sslSocketFactory(getSimpleTrustedSSLSocketFactory(), trustAllCerts)
|
||||||
|
.hostnameVerifier(new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String s, SSLSession sslSession) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).proxySelector(proxySelector).build();
|
||||||
|
return okHttpClient;
|
||||||
|
} else {
|
||||||
|
SSLSocketFactory trustedSSLSocketFactory = getTrustedSSLSocketFactory();
|
||||||
|
okHttpClient = new OkHttpClient.Builder()
|
||||||
|
.connectTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.writeTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.readTimeout(TIMEOUT, TimeUnit.SECONDS)
|
||||||
|
.connectionPool(new ConnectionPool(TIMEOUT, TIMEOUT, TimeUnit.SECONDS))
|
||||||
|
.sslSocketFactory(trustedSSLSocketFactory)
|
||||||
|
.proxySelector(proxySelector).build();
|
||||||
|
return okHttpClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SSLSocketFactory getSimpleTrustedSSLSocketFactory() {
|
||||||
|
try {
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkClientTrusted(
|
||||||
|
java.security.cert.X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkServerTrusted(
|
||||||
|
java.security.cert.X509Certificate[] certs, String authType) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
sc.init(null, trustAllCerts, new SecureRandom());
|
||||||
|
return sc.getSocketFactory();
|
||||||
|
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||||
|
log.error("Error while creating the SSL socket factory due to " + e.getMessage(), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SSLSocketFactory getTrustedSSLSocketFactory() {
|
||||||
|
try {
|
||||||
|
String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password");
|
||||||
|
String keyStoreLocation = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Location");
|
||||||
|
String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty(
|
||||||
|
"Security.TrustStore.Password");
|
||||||
|
String trustStoreLocation = ServerConfiguration.getInstance().getFirstProperty(
|
||||||
|
"Security.TrustStore.Location");
|
||||||
|
KeyStore keyStore = loadKeyStore(keyStoreLocation, keyStorePassword, KEY_STORE_TYPE);
|
||||||
|
KeyStore trustStore = loadTrustStore(trustStoreLocation, trustStorePassword);
|
||||||
|
|
||||||
|
return initSSLConnection(keyStore, keyStorePassword, trustStore);
|
||||||
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException
|
||||||
|
| CertificateException | IOException | UnrecoverableKeyException e) {
|
||||||
|
log.error("Error while creating the SSL socket factory due to " + e.getMessage(), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SSLSocketFactory initSSLConnection(KeyStore keyStore, String keyStorePassword, KeyStore trustStore)
|
||||||
|
throws NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException {
|
||||||
|
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE);
|
||||||
|
keyManagerFactory.init(keyStore, keyStorePassword.toCharArray());
|
||||||
|
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE);
|
||||||
|
trustManagerFactory.init(trustStore);
|
||||||
|
|
||||||
|
// Create and initialize SSLContext for HTTPS communication
|
||||||
|
SSLContext sslContext = SSLContext.getInstance(SSLV3);
|
||||||
|
sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
|
||||||
|
SSLContext.setDefault(sslContext);
|
||||||
|
return sslContext.getSocketFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KeyStore loadKeyStore(String keyStorePath, String ksPassword, String type)
|
||||||
|
throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
|
||||||
|
InputStream fileInputStream = null;
|
||||||
|
try {
|
||||||
|
char[] keypassChar = ksPassword.toCharArray();
|
||||||
|
KeyStore keyStore = KeyStore.getInstance(type);
|
||||||
|
fileInputStream = new FileInputStream(keyStorePath);
|
||||||
|
keyStore.load(fileInputStream, keypassChar);
|
||||||
|
return keyStore;
|
||||||
|
} finally {
|
||||||
|
if (fileInputStream != null) {
|
||||||
|
fileInputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KeyStore loadTrustStore(String trustStorePath, String tsPassword)
|
||||||
|
throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
|
||||||
|
return loadKeyStore(trustStorePath, tsPassword, TRUST_STORE_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.entgra.device.mgt.core.apimgt.extension.rest.api.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the scope data.
|
||||||
|
*/
|
||||||
|
public class ScopeUtils {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String name;
|
||||||
|
private String roles;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(String roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() {
|
||||||
|
String jsonString = "{\n" +
|
||||||
|
" \"name\":\" " + key + "\",\n" +
|
||||||
|
" \"displayName\":\" " + name + "\",\n" +
|
||||||
|
" \"description\":\" " + description + " \",\n" +
|
||||||
|
" \"bindings\":[\n" +
|
||||||
|
" \" " + roles + " \"\n" +
|
||||||
|
" ]\n" +
|
||||||
|
"}";
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -122,6 +122,15 @@
|
|||||||
<artifactId>h2-database-engine</artifactId>
|
<artifactId>h2-database-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>io.entgra.device.mgt.core.apimgt.extension.rest.api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json.wso2</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
@ -165,6 +174,9 @@
|
|||||||
org.scannotation;version="1.0",
|
org.scannotation;version="1.0",
|
||||||
org.scannotation.archiveiterator;version="1.0",
|
org.scannotation.archiveiterator;version="1.0",
|
||||||
org.w3c.dom,
|
org.w3c.dom,
|
||||||
|
io.entgra.device.mgt.core.apimgt.extension.rest.api,
|
||||||
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.dto,
|
||||||
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions,
|
||||||
org.wso2.carbon.apimgt.annotations.api,
|
org.wso2.carbon.apimgt.annotations.api,
|
||||||
org.wso2.carbon.apimgt.api,
|
org.wso2.carbon.apimgt.api,
|
||||||
org.wso2.carbon.apimgt.api.model,
|
org.wso2.carbon.apimgt.api.model,
|
||||||
@ -187,7 +199,8 @@
|
|||||||
org.wso2.carbon.utils;version="4.6",
|
org.wso2.carbon.utils;version="4.6",
|
||||||
org.wso2.carbon.utils.multitenancy;version="4.6",
|
org.wso2.carbon.utils.multitenancy;version="4.6",
|
||||||
org.wso2.carbon.apimgt.impl.definitions,
|
org.wso2.carbon.apimgt.impl.definitions,
|
||||||
org.apache.commons.lang
|
org.apache.commons.lang,
|
||||||
|
org.json
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<Embed-Dependency>
|
<Embed-Dependency>
|
||||||
jsr311-api;scope=compile|runtime;inline=false
|
jsr311-api;scope=compile|runtime;inline=false
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* This bean class carries the properties used by some API that needs to be published within the underlying
|
* This bean class carries the properties used by some API that needs to be published within the underlying
|
||||||
* API-Management infrastructure.
|
* API-Management infrastructure.
|
||||||
*
|
|
||||||
* A sample API configuration accepted by this particular bean class would look like what's shown below.
|
* A sample API configuration accepted by this particular bean class would look like what's shown below.
|
||||||
* e.g.
|
* e.g.
|
||||||
*
|
*
|
||||||
@ -47,6 +46,9 @@ public class APIConfig {
|
|||||||
private String name;
|
private String name;
|
||||||
private String owner;
|
private String owner;
|
||||||
private String context;
|
private String context;
|
||||||
|
private String apiDocumentationName;
|
||||||
|
private String apiDocumentationSummary;
|
||||||
|
private String apiDocumentationSourceFile;
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
private String version;
|
private String version;
|
||||||
private String policy;
|
private String policy;
|
||||||
@ -82,6 +84,33 @@ public class APIConfig {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentationName", required = false)
|
||||||
|
public String getApiDocumentationName() {
|
||||||
|
return apiDocumentationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiDocumentationName(String apiDocumentationName) {
|
||||||
|
this.apiDocumentationName = apiDocumentationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentationSummary", required = false)
|
||||||
|
public String getApiDocumentationSummary() {
|
||||||
|
return apiDocumentationSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiDocumentationSummary(String apiDocumentationSummary) {
|
||||||
|
this.apiDocumentationSummary = apiDocumentationSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentationSourceFile", required = false)
|
||||||
|
public String getApiDocumentationSourceFile() {
|
||||||
|
return apiDocumentationSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiDocumentationSourceFile(String apiDocumentationSourceFile) {
|
||||||
|
this.apiDocumentationSourceFile = apiDocumentationSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
@XmlElement(name = "Owner", required = true)
|
@XmlElement(name = "Owner", required = true)
|
||||||
public String getOwner() {
|
public String getOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
|
|||||||
@ -18,9 +18,22 @@
|
|||||||
*/
|
*/
|
||||||
package org.wso2.carbon.apimgt.webapp.publisher;
|
package org.wso2.carbon.apimgt.webapp.publisher;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
|
||||||
|
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.apimgt.api.model.Documentation;
|
||||||
|
import org.wso2.carbon.apimgt.api.model.DocumentationType;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.wso2.carbon.apimgt.api.APIManagementException;
|
import org.wso2.carbon.apimgt.api.APIManagementException;
|
||||||
import org.wso2.carbon.apimgt.api.APIProvider;
|
import org.wso2.carbon.apimgt.api.APIProvider;
|
||||||
import org.wso2.carbon.apimgt.api.FaultGatewaysException;
|
import org.wso2.carbon.apimgt.api.FaultGatewaysException;
|
||||||
@ -48,7 +61,6 @@ import org.wso2.carbon.user.core.tenant.Tenant;
|
|||||||
import org.wso2.carbon.user.core.tenant.TenantSearchResult;
|
import org.wso2.carbon.user.core.tenant.TenantSearchResult;
|
||||||
import org.wso2.carbon.utils.CarbonUtils;
|
import org.wso2.carbon.utils.CarbonUtils;
|
||||||
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||||
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -66,18 +78,19 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the concrete implementation of the APIPublisherService that corresponds to providing all
|
* This class represents the concrete implementation of the APIPublisherService that corresponds to providing all
|
||||||
* API publishing related operations.
|
* API publishing related operations.
|
||||||
*/
|
*/
|
||||||
public class APIPublisherServiceImpl implements APIPublisherService {
|
public class APIPublisherServiceImpl implements APIPublisherService {
|
||||||
|
public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance();
|
||||||
private static final String UNLIMITED_TIER = "Unlimited";
|
private static final String UNLIMITED_TIER = "Unlimited";
|
||||||
private static final String WS_UNLIMITED_TIER = "AsyncUnlimited";
|
private static final String WS_UNLIMITED_TIER = "AsyncUnlimited";
|
||||||
private static final String API_PUBLISH_ENVIRONMENT = "Default";
|
private static final String API_PUBLISH_ENVIRONMENT = "Default";
|
||||||
private static final String CREATED_STATUS = "CREATED";
|
private static final String CREATED_STATUS = "CREATED";
|
||||||
private static final String PUBLISH_ACTION = "Publish";
|
private static final String PUBLISH_ACTION = "Publish";
|
||||||
public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance();
|
|
||||||
private static final Log log = LogFactory.getLog(APIPublisherServiceImpl.class);
|
private static final Log log = LogFactory.getLog(APIPublisherServiceImpl.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -293,7 +306,45 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FaultGatewaysException | APIManagementException e) {
|
if (apiConfig.getApiDocumentationSourceFile() != null) {
|
||||||
|
API api = getAPI(apiConfig, true);
|
||||||
|
|
||||||
|
String fileName =
|
||||||
|
CarbonUtils.getCarbonHome() + File.separator + "repository" +
|
||||||
|
File.separator + "resources" + File.separator + "api-docs" + File.separator +
|
||||||
|
apiConfig.getApiDocumentationSourceFile();
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(fileName));
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
String line = null;
|
||||||
|
String ls = System.lineSeparator();
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
stringBuilder.append(line);
|
||||||
|
stringBuilder.append(ls);
|
||||||
|
}
|
||||||
|
stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
||||||
|
br.close();
|
||||||
|
String docContent = stringBuilder.toString();
|
||||||
|
|
||||||
|
Documentation apiDocumentation = new Documentation(DocumentationType.HOWTO, apiConfig.getApiDocumentationName());
|
||||||
|
apiDocumentation.setVisibility(Documentation.DocumentVisibility.API_LEVEL);
|
||||||
|
apiDocumentation.setSourceType(Documentation.DocumentSourceType.MARKDOWN);
|
||||||
|
apiDocumentation.setCreatedDate(new Date());
|
||||||
|
apiDocumentation.setLastUpdated(new Date());
|
||||||
|
apiDocumentation.setSummary(apiConfig.getApiDocumentationSummary());
|
||||||
|
apiDocumentation.setOtherTypeName(null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//Including below code lines inside the try block because 'getDocumentation' method returns an APIManagementException exception when it doesn't have any existing doc
|
||||||
|
Documentation existingDoc = apiProvider.getDocumentation(api.getId(), DocumentationType.HOWTO, apiConfig.getApiDocumentationName());
|
||||||
|
apiProvider.removeDocumentation(api.getId(), existingDoc.getId(), null);
|
||||||
|
} catch (APIManagementException e) {
|
||||||
|
log.info("There is no any existing api documentation.");
|
||||||
|
}
|
||||||
|
apiProvider.addDocumentation(api.getId(), apiDocumentation);
|
||||||
|
apiProvider.addDocumentationContent(api, apiConfig.getApiDocumentationName(), docContent);
|
||||||
|
}
|
||||||
|
} catch (FaultGatewaysException | APIManagementException | IOException e) {
|
||||||
String msg = "Error occurred while publishing api";
|
String msg = "Error occurred while publishing api";
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
throw new APIManagerPublisherException(e);
|
throw new APIManagerPublisherException(e);
|
||||||
@ -316,13 +367,26 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
WebappPublisherConfig config = WebappPublisherConfig.getInstance();
|
WebappPublisherConfig config = WebappPublisherConfig.getInstance();
|
||||||
List<String> tenants = new ArrayList<>(Collections.singletonList(APIConstants.SUPER_TENANT_DOMAIN));
|
List<String> tenants = new ArrayList<>(Collections.singletonList(APIConstants.SUPER_TENANT_DOMAIN));
|
||||||
tenants.addAll(config.getTenants().getTenant());
|
tenants.addAll(config.getTenants().getTenant());
|
||||||
|
|
||||||
|
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
|
||||||
|
APIApplicationKey apiApplicationKey;
|
||||||
|
AccessTokenInfo accessTokenInfo;
|
||||||
|
try {
|
||||||
|
apiApplicationKey = apiApplicationServices.createAndRetrieveApplicationCredentials();
|
||||||
|
accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication(
|
||||||
|
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
|
||||||
|
} catch (APIServicesException e) {
|
||||||
|
String errorMsg = "Error while generating application";
|
||||||
|
log.error(errorMsg, e);
|
||||||
|
throw new APIManagerPublisherException(e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (String tenantDomain : tenants) {
|
for (String tenantDomain : tenants) {
|
||||||
PrivilegedCarbonContext.startTenantFlow();
|
PrivilegedCarbonContext.startTenantFlow();
|
||||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
|
||||||
APIProvider apiProvider = API_MANAGER_FACTORY.getAPIProvider(MultitenantUtils.getTenantAwareUsername(
|
PublisherRESTAPIServices publisherRESTAPIServices = new PublisherRESTAPIServicesImpl();
|
||||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration()
|
JSONObject scopeObject = publisherRESTAPIServices.getScopes(apiApplicationKey, accessTokenInfo);
|
||||||
.getAdminUserName()));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String fileName =
|
String fileName =
|
||||||
@ -368,8 +432,18 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
}
|
}
|
||||||
scope.setRoles(roleString);
|
scope.setRoles(roleString);
|
||||||
|
|
||||||
if (apiProvider.isSharedScopeNameExists(scope.getKey(), tenantDomain)) {
|
//Set scope id which related to the scope key
|
||||||
apiProvider.updateSharedScope(scope, tenantDomain);
|
JSONArray scopeList = (JSONArray) scopeObject.get("list");
|
||||||
|
for (int i = 0; i < scopeList.length(); i++) {
|
||||||
|
JSONObject scopeObj = scopeList.getJSONObject(i);
|
||||||
|
if (scopeObj.getString("name").equals(scopeMapping[2] != null ?
|
||||||
|
StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY)) {
|
||||||
|
scope.setId(scopeObj.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publisherRESTAPIServices.isSharedScopeNameExists(apiApplicationKey, accessTokenInfo, scope.getKey())) {
|
||||||
|
publisherRESTAPIServices.updateSharedScope(apiApplicationKey, accessTokenInfo, scope);
|
||||||
} else {
|
} else {
|
||||||
// todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list
|
// todo: come to this level means, that scope is removed from API, but haven't removed from the scope-role-permission-mappings list
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
@ -380,16 +454,25 @@ public class APIPublisherServiceImpl implements APIPublisherService {
|
|||||||
}
|
}
|
||||||
} catch (IOException | DirectoryIteratorException ex) {
|
} catch (IOException | DirectoryIteratorException ex) {
|
||||||
log.error("failed to read scopes from file.", ex);
|
log.error("failed to read scopes from file.", ex);
|
||||||
|
} catch (APIServicesException | BadRequestException e) {
|
||||||
|
String errorMsg = "Error while calling APIs";
|
||||||
|
log.error(errorMsg, e);
|
||||||
|
throw new APIManagerPublisherException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (UserStoreException e) {
|
}
|
||||||
String msg = "Error occurred while reading tenant admin username";
|
catch (APIServicesException e) {
|
||||||
log.error(msg, e);
|
String errorMsg = "Error while processing Publisher REST API response";
|
||||||
|
log.error(errorMsg, e);
|
||||||
throw new APIManagerPublisherException(e);
|
throw new APIManagerPublisherException(e);
|
||||||
} catch (APIManagementException e) {
|
} catch (BadRequestException e) {
|
||||||
String msg = "Error occurred while loading api provider";
|
String errorMsg = "Error while calling Publisher REST APIs";
|
||||||
log.error(msg, e);
|
log.error(errorMsg, e);
|
||||||
|
throw new APIManagerPublisherException(e);
|
||||||
|
} catch (UnexpectedResponseException e) {
|
||||||
|
String errorMsg = "Unexpected response from the server";
|
||||||
|
log.error(errorMsg, e);
|
||||||
throw new APIManagerPublisherException(e);
|
throw new APIManagerPublisherException(e);
|
||||||
}finally {
|
}finally {
|
||||||
PrivilegedCarbonContext.endTenantFlow();
|
PrivilegedCarbonContext.endTenantFlow();
|
||||||
|
|||||||
@ -104,7 +104,32 @@ public class APIPublisherUtil {
|
|||||||
}
|
}
|
||||||
apiConfig.setVersion(version);
|
apiConfig.setVersion(version);
|
||||||
|
|
||||||
|
String apiDocumentationName = apiDef.getApiDocumentationName();
|
||||||
|
if (apiDocumentationName == null || apiDocumentationName.isEmpty()) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("'API Documentation not set in @SwaggerDefinition Annotation'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiConfig.setApiDocumentationName(apiDef.getApiDocumentationName());
|
||||||
|
}
|
||||||
|
|
||||||
|
String apiDocumentationSummary = apiDef.getApiDocumentationSummary();
|
||||||
|
if (apiDocumentationSummary == null || apiDocumentationSummary.isEmpty()) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("'API Documentation summary not set in @SwaggerDefinition Annotation'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiConfig.setApiDocumentationSummary(apiDef.getApiDocumentationSummary());
|
||||||
|
}
|
||||||
|
|
||||||
|
String apiDocumentationSourceFile = apiDef.getApiDocumentationSourceFile();
|
||||||
|
if (apiDocumentationSourceFile == null || apiDocumentationSourceFile.isEmpty()) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("'API Documentation source file not set in @SwaggerDefinition Annotation'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiConfig.setApiDocumentationSourceFile(apiDef.getApiDocumentationSourceFile());
|
||||||
|
}
|
||||||
String context = apiDef.getContext();
|
String context = apiDef.getContext();
|
||||||
if (context == null || context.isEmpty()) {
|
if (context == null || context.isEmpty()) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
|
|||||||
@ -27,6 +27,9 @@ public class APIResourceConfiguration {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String context;
|
private String context;
|
||||||
|
private String apiDocumentationName;
|
||||||
|
private String apiDocumentationSummary;
|
||||||
|
private String apiDocumentationSourceFile;
|
||||||
private String version;
|
private String version;
|
||||||
private List<APIResource> resources;
|
private List<APIResource> resources;
|
||||||
private String[] tags;
|
private String[] tags;
|
||||||
@ -62,6 +65,35 @@ public class APIResourceConfiguration {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApiDocumentationName() {
|
||||||
|
return apiDocumentationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentation")
|
||||||
|
|
||||||
|
|
||||||
|
public void setApiDocumentationName(String apiDocumentationName) {
|
||||||
|
this.apiDocumentationName = apiDocumentationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiDocumentationSummary() {
|
||||||
|
return apiDocumentationSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentationSummary")
|
||||||
|
public void setApiDocumentationSummary(String apiDocumentationSummary) {
|
||||||
|
this.apiDocumentationSummary = apiDocumentationSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiDocumentationSourceFile() {
|
||||||
|
return apiDocumentationSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ApiDocumentationSourceFile")
|
||||||
|
public void setApiDocumentationSourceFile(String apiDocumentationSourceFile) {
|
||||||
|
this.apiDocumentationSourceFile = apiDocumentationSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
@ -110,6 +142,7 @@ public class APIResourceConfiguration {
|
|||||||
public String getAsyncApiDefinition() {
|
public String getAsyncApiDefinition() {
|
||||||
return asyncApiDefinition;
|
return asyncApiDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "asyncApiDefinition")
|
@XmlElement(name = "asyncApiDefinition")
|
||||||
public void setAsyncApiDefinition(String asyncApiDefinition) {
|
public void setAsyncApiDefinition(String asyncApiDefinition) {
|
||||||
this.asyncApiDefinition = asyncApiDefinition;
|
this.asyncApiDefinition = asyncApiDefinition;
|
||||||
|
|||||||
@ -53,7 +53,6 @@ import java.util.*;
|
|||||||
public class AnnotationProcessor {
|
public class AnnotationProcessor {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(AnnotationProcessor.class);
|
private static final Log log = LogFactory.getLog(AnnotationProcessor.class);
|
||||||
|
|
||||||
private static final String AUTH_TYPE = "Application & Application User";
|
private static final String AUTH_TYPE = "Application & Application User";
|
||||||
private static final String STRING_ARR = "string_arr";
|
private static final String STRING_ARR = "string_arr";
|
||||||
private static final String STRING = "string";
|
private static final String STRING = "string";
|
||||||
@ -61,7 +60,6 @@ public class AnnotationProcessor {
|
|||||||
private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus";
|
private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus";
|
||||||
private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework";
|
private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework";
|
||||||
public static final String WILD_CARD = "/*";
|
public static final String WILD_CARD = "/*";
|
||||||
|
|
||||||
private static final String SWAGGER_ANNOTATIONS_INFO = "info";
|
private static final String SWAGGER_ANNOTATIONS_INFO = "info";
|
||||||
private static final String SWAGGER_ANNOTATIONS_TAGS = "tags";
|
private static final String SWAGGER_ANNOTATIONS_TAGS = "tags";
|
||||||
private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions";
|
private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions";
|
||||||
@ -73,6 +71,9 @@ public class AnnotationProcessor {
|
|||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_ROLES = "roles";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_ROLES = "roles";
|
||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VERSION = "version";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VERSION = "version";
|
||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_CONTEXT = "context";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_CONTEXT = "context";
|
||||||
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_NAME = "apiDocumentationName";
|
||||||
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_SUMMARY = "apiDocumentationSummary";
|
||||||
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_SOURCE_FILE = "apiDocumentationSourceFile";
|
||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_ENDPOINT_TYPE = "endpointType";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_ENDPOINT_TYPE = "endpointType";
|
||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_IN_SEQUENCE_NAME = "inSequenceName";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_IN_SEQUENCE_NAME = "inSequenceName";
|
||||||
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_IN_SEQUENCE_CONFIG = "inSequenceConfig";
|
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_IN_SEQUENCE_CONFIG = "inSequenceConfig";
|
||||||
@ -131,7 +132,6 @@ public class AnnotationProcessor {
|
|||||||
log.error("An error has occurred while loading classes ", e);
|
log.error("An error has occurred while loading classes ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> scanStandardContext(String className) throws IOException {
|
public Set<String> scanStandardContext(String className) throws IOException {
|
||||||
ExtendedAnnotationDB db = new ExtendedAnnotationDB();
|
ExtendedAnnotationDB db = new ExtendedAnnotationDB();
|
||||||
db.addIgnoredPackages(PACKAGE_ORG_APACHE);
|
db.addIgnoredPackages(PACKAGE_ORG_APACHE);
|
||||||
@ -369,7 +369,7 @@ public class AnnotationProcessor {
|
|||||||
* Iterate API annotation and build API Configuration
|
* Iterate API annotation and build API Configuration
|
||||||
*
|
*
|
||||||
* @param annotation reading @SwaggerDefinition annotation
|
* @param annotation reading @SwaggerDefinition annotation
|
||||||
* @return APIResourceConfiguration which compose with an API information which has its name, context,version,and tags
|
* @return APIResourceConfiguration which compose with an API information which has its name, context, version, api-documentation, and tags
|
||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
*/
|
*/
|
||||||
private APIResourceConfiguration processAPIAnnotation(Annotation annotation) throws Throwable {
|
private APIResourceConfiguration processAPIAnnotation(Annotation annotation) throws Throwable {
|
||||||
@ -411,6 +411,18 @@ public class AnnotationProcessor {
|
|||||||
if ("".equals(value)) return null;
|
if ("".equals(value)) return null;
|
||||||
apiResourceConfig.setContext(value);
|
apiResourceConfig.setContext(value);
|
||||||
break;
|
break;
|
||||||
|
case SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_NAME:
|
||||||
|
if ("".equals(value)) return null;
|
||||||
|
apiResourceConfig.setApiDocumentationName(value);
|
||||||
|
break;
|
||||||
|
case SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_SUMMARY:
|
||||||
|
if ("".equals(value)) return null;
|
||||||
|
apiResourceConfig.setApiDocumentationSummary(value);
|
||||||
|
break;
|
||||||
|
case SWAGGER_ANNOTATIONS_PROPERTIES_API_DOCUMENTATION_SOURCE_FILE:
|
||||||
|
if ("".equals(value)) return null;
|
||||||
|
apiResourceConfig.setApiDocumentationSourceFile(value);
|
||||||
|
break;
|
||||||
case SWAGGER_ANNOTATIONS_PROPERTIES_ENDPOINT_TYPE:
|
case SWAGGER_ANNOTATIONS_PROPERTIES_ENDPOINT_TYPE:
|
||||||
if ("".equals(value))
|
if ("".equals(value))
|
||||||
return null;
|
return null;
|
||||||
@ -485,19 +497,15 @@ public class AnnotationProcessor {
|
|||||||
* @param servletContext
|
* @param servletContext
|
||||||
* @return null if cannot determin /WEB-INF/classes
|
* @return null if cannot determin /WEB-INF/classes
|
||||||
*/
|
*/
|
||||||
private static URL findWebInfClassesPath(ServletContext servletContext)
|
private static URL findWebInfClassesPath(ServletContext servletContext) {
|
||||||
{
|
|
||||||
String path = servletContext.getRealPath("/WEB-INF/classes");
|
String path = servletContext.getRealPath("/WEB-INF/classes");
|
||||||
if (path == null) return null;
|
if (path == null) return null;
|
||||||
File fp = new File(path);
|
File fp = new File(path);
|
||||||
if (fp.exists() == false) return null;
|
if (fp.exists() == false) return null;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
URI uri = fp.toURI();
|
URI uri = fp.toURI();
|
||||||
return uri.toURL();
|
return uri.toURL();
|
||||||
}
|
} catch (MalformedURLException e) {
|
||||||
catch (MalformedURLException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -40,6 +40,7 @@
|
|||||||
<module>org.wso2.carbon.apimgt.keymgt.extension</module>
|
<module>org.wso2.carbon.apimgt.keymgt.extension</module>
|
||||||
<module>org.wso2.carbon.apimgt.keymgt.extension.api</module>
|
<module>org.wso2.carbon.apimgt.keymgt.extension.api</module>
|
||||||
<module>io.entgra.device.mgt.core.apimgt.analytics.extension</module>
|
<module>io.entgra.device.mgt.core.apimgt.analytics.extension</module>
|
||||||
|
<module>io.entgra.device.mgt.core.apimgt.extension.rest.api</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3244,7 +3244,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|||||||
AtomicReference<ApplicationReleaseDTO> applicationReleaseDTO = new AtomicReference<>(
|
AtomicReference<ApplicationReleaseDTO> applicationReleaseDTO = new AtomicReference<>(
|
||||||
applicationDTO.getApplicationReleaseDTOs().get(0));
|
applicationDTO.getApplicationReleaseDTOs().get(0));
|
||||||
validateAppReleaseUpdating(customAppReleaseWrapper, applicationDTO, applicationArtifact,
|
validateAppReleaseUpdating(customAppReleaseWrapper, applicationDTO, applicationArtifact,
|
||||||
ApplicationType.ENTERPRISE.toString());
|
ApplicationType.CUSTOM.toString());
|
||||||
applicationReleaseDTO.get().setPrice(customAppReleaseWrapper.getPrice());
|
applicationReleaseDTO.get().setPrice(customAppReleaseWrapper.getPrice());
|
||||||
applicationReleaseDTO.get()
|
applicationReleaseDTO.get()
|
||||||
.setIsSharedWithAllTenants(applicationReleaseDTO.get().getIsSharedWithAllTenants());
|
.setIsSharedWithAllTenants(applicationReleaseDTO.get().getIsSharedWithAllTenants());
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>heartbeat-management</artifactId>
|
<artifactId>heartbeat-management</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>identity-extensions</artifactId>
|
<artifactId>identity-extensions</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>identity-extensions</artifactId>
|
<artifactId>identity-extensions</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>logger</artifactId>
|
<artifactId>logger</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>io.entgra.notification.logger</artifactId>
|
<artifactId>io.entgra.notification.logger</artifactId>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,11 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>subtype-mgt</artifactId>
|
<artifactId>subtype-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,11 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>task-manager</artifactId>
|
<artifactId>task-manager</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>task-manager</artifactId>
|
<artifactId>task-manager</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>task-mgt</artifactId>
|
<artifactId>task-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>task-watcher</artifactId>
|
<artifactId>task-watcher</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>task-mgt</artifactId>
|
<artifactId>task-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,13 +16,11 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tenant-mgt</artifactId>
|
<artifactId>tenant-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,13 +16,11 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tenant-mgt</artifactId>
|
<artifactId>tenant-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,13 +16,11 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>email-sender</artifactId>
|
<artifactId>email-sender</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>transport-mgt</artifactId>
|
<artifactId>transport-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>sms-handler</artifactId>
|
<artifactId>sms-handler</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>sms-handler</artifactId>
|
<artifactId>sms-handler</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>sms-handler</artifactId>
|
<artifactId>sms-handler</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>transport-mgt</artifactId>
|
<artifactId>transport-mgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ui-request-interceptor</artifactId>
|
<artifactId>ui-request-interceptor</artifactId>
|
||||||
<groupId>io.entgra.devicemgt</groupId>
|
<groupId>io.entgra.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>webapp-authenticator-framework</artifactId>
|
<artifactId>webapp-authenticator-framework</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>grafana-mgt-feature</artifactId>
|
<artifactId>grafana-mgt-feature</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>grafana-mgt-feature</artifactId>
|
<artifactId>grafana-mgt-feature</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>analytics-mgt-feature</artifactId>
|
<artifactId>analytics-mgt-feature</artifactId>
|
||||||
<version>5.0.25-SNAPSHOT</version>
|
<version>5.0.26-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user