From a12be72a1317f3b578f85bc4e84c4ae9f1bec6c2 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Fri, 14 May 2021 10:34:41 +0530 Subject: [PATCH] updated to kernel 4.6.2 --- .../pom.xml | 29 +++++----- .../APIManagementProviderService.java | 21 -------- .../APIManagementProviderServiceImpl.java | 53 ++++--------------- .../publisher/APIPublisherServiceImpl.java | 4 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.core/pom.xml | 2 - .../ui/request/interceptor/LoginHandler.java | 2 +- pom.xml | 45 +++++++--------- 8 files changed, 44 insertions(+), 114 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 3f0f92602b..0282a89040 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -73,11 +73,6 @@ org.wso2.carbon.identity.jwt.client.extension provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - @@ -109,28 +104,28 @@ org.apache.commons.lang;version="[2.6,3)", org.apache.commons.logging;version="[1.2,2)", - org.json.simple,org.osgi.framework;version="${imp.package.version.osgi.framework}", - org.osgi.service.component;version="${imp.package.version.osgi.service}", - org.wso2.carbon.apimgt.api;version="[9.0,10)", - org.wso2.carbon.apimgt.api.dto;version="[9.0,10)", - org.wso2.carbon.apimgt.api.model;version="[9.0,10)", + org.json.simple, + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.wso2.carbon.apimgt.api;version="${carbon.api.mgt.version.range}", + org.wso2.carbon.apimgt.api.dto;version="${carbon.api.mgt.version.range}", + org.wso2.carbon.apimgt.api.model;version="${carbon.api.mgt.version.range}", org.wso2.carbon.apimgt.application.extension.bean, org.wso2.carbon.apimgt.application.extension.dto, org.wso2.carbon.apimgt.application.extension.exception, - org.wso2.carbon.apimgt.impl;version="[9.0,10)", - org.wso2.carbon.apimgt.impl.utils;version="[9.0,10)", - org.wso2.carbon.context;version="[4.6,5)", - org.wso2.carbon.device.mgt.core.config.ui;version="[4.1,5)", + 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.context;version="${carbon.kernel.version.range}", org.wso2.carbon.identity.jwt.client.extension, org.wso2.carbon.identity.jwt.client.extension.dto, org.wso2.carbon.identity.jwt.client.extension.exception, org.wso2.carbon.identity.jwt.client.extension.service, org.wso2.carbon.registry.core.exceptions;version="[1.0,2)", org.wso2.carbon.registry.core.service;version="[1.0,2)", - org.wso2.carbon.registry.indexing.service;version="[4.7,5)", + org.wso2.carbon.registry.indexing.service;version="${carbon.registry.imp.pkg.version.range}", org.wso2.carbon.user.api;version="[1.0,2)", - org.wso2.carbon.user.core.service;version="[4.6,5)", - org.wso2.carbon.user.core.tenant;version="[4.6,5)" + org.wso2.carbon.user.core.service;version="${carbon.kernel.version.range}", + org.wso2.carbon.user.core.tenant;version="${carbon.kernel.version.range}" !org.wso2.carbon.apimgt.application.extension.internal, diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java index d1bc3911b6..7405737237 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java @@ -50,27 +50,6 @@ public interface APIManagementProviderService { String keyType, String username, boolean isAllowedAllDomains, String validityTime) throws APIManagerException; - /** - * Generate and retreive application keys. if the application does exist then - * create it and subscribe to apis that are grouped with the tags. - * - * @param apiApplicationName name of the application. - * @param tags tags of the apis that application needs to be subscribed. - * @param keyType of the application. - * @param username to whom the application is created - * @param isAllowedAllDomains application is allowed to all the tenants - * @param validityTime validity period of the application - * @param scopes scopes - * @return consumerkey and secrete of the created application. - * @throws APIManagerException - */ - ApiApplicationKey generateAndRetrieveApplicationKeys(String apiApplicationName, - String tags[], - String keyType, - String username, - boolean isAllowedAllDomains, - String validityTime, String scopes) throws APIManagerException; - /** * Remove APIM Application. */ diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 3b46ace15f..40d13f7eda 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -42,8 +42,6 @@ import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.core.config.ui.UIConfiguration; -import org.wso2.carbon.device.mgt.core.config.ui.UIConfigurationManager; import org.wso2.carbon.identity.jwt.client.extension.JWTClient; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; @@ -101,7 +99,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe */ @Override public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[], - String keyType, String username, boolean isAllowedAllDomains, String validityTime, String scopes) + String keyType, String username, boolean isAllowedAllDomains, String validityTime) throws APIManagerException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); @@ -125,14 +123,14 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe application = new Application(applicationName, subscriber); application.setTier(ApiApplicationConstants.DEFAULT_TIER); application.setGroupId(""); - applicationId = apiConsumer.addApplication(application, username); + apiConsumer.addApplication(application, username); + application = apiConsumer.getApplicationsByName(username, applicationName, ""); } else { - applicationId = application.getId(); subscriber = apiConsumer.getSubscriber(username); } Set subscribedAPIs = - apiConsumer.getSubscribedAPIsByApplicationId(subscriber, applicationId, ""); + apiConsumer.getSubscribedAPIs(subscriber, applicationName, ""); log.info("Already subscribed API count: " + subscribedAPIs.size()); @@ -160,9 +158,11 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } } if (!subscriptionExist && !tempApiIds.contains(id)) { - ApiTypeWrapper apiTypeWrapper = new ApiTypeWrapper(apiInfo); + ApiTypeWrapper apiTypeWrapper = apiConsumer.getAPIorAPIProductByUUID( + apiInfo.getUuid(), tenantDomain); apiTypeWrapper.setTier(ApiApplicationConstants.DEFAULT_TIER); - apiConsumer.addSubscription(apiTypeWrapper, username, applicationId, ""); + + apiConsumer.addSubscription(apiTypeWrapper, username, application); tempApiIds.add(id); } } @@ -210,31 +210,9 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe "\\\"id_token_expiry_time\\\":\\\"N\\/A\\\"}\"," + "\"username\":\"" + username + "\"}"; - // if scopes not defined - if (StringUtils.isEmpty(scopes)) { - UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance(); - UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig(); - List scopeList = uiConfiguration.getScopes(); - - if (scopeList != null && scopeList.size() > 0) { - StringBuilder builder = new StringBuilder(); - for (String scope : scopeList) { - String tmpScope = scope + " "; - builder.append(tmpScope); - } - scopes = builder.toString(); - } - - if (StringUtils.isEmpty(scopes)) { - scopes = scopes.trim(); - } else { - scopes = "default"; - } - } - Map keyDetails = apiConsumer .requestApprovalForApplicationRegistration(username, applicationName, keyType, "", - allowedDomains.toArray(new String[allowedDomains.size()]), validityTime, scopes, "", + allowedDomains.toArray(new String[allowedDomains.size()]), validityTime, "default", "", jsonString, keyManagerId, tenantDomain); if (keyDetails != null) { @@ -252,19 +230,6 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } } - /** - * {@inheritDoc} - */ - @Override - public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[], - String keyType, String username, - boolean isAllowedAllDomains, - String validityTime) - throws APIManagerException { - return this.generateAndRetrieveApplicationKeys(applicationName, tags, keyType, username, - isAllowedAllDomains, validityTime, null); - } - @Override public AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, String validityPeriod) throws APIManagerException { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index d1312714c1..b1c7769768 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -50,7 +50,7 @@ import java.util.Set; */ public class APIPublisherServiceImpl implements APIPublisherService { private static final String UNLIMITED_TIER = "Unlimited"; - private static final String API_PUBLISH_ENVIRONMENT = "Production and Sandbox"; + private static final String API_PUBLISH_ENVIRONMENT = "Default"; private static final String CREATED_STATUS = "CREATED"; private static final String PUBLISH_ACTION = "Publish"; public static final APIManagerFactory API_MANAGER_FACTORY = APIManagerFactory.getInstance(); @@ -179,7 +179,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { accessControlAllowHeaders.add("Content-Type"); accessControlAllowHeaders.add("SOAPAction"); accessControlAllowHeaders.add("apikey"); - accessControlAllowHeaders.add("testKey"); + accessControlAllowHeaders.add("Internal-Key"); List accessControlAllowMethods = new ArrayList<>(); accessControlAllowMethods.add("GET"); accessControlAllowMethods.add("PUT"); diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 81ac96adc5..2a60c2797e 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -140,7 +140,7 @@ org.wso2.carbon.context, org.wso2.carbon.device.mgt.common.operation.mgt, org.wso2.carbon.device.mgt.common.push.notification, - org.wso2.carbon.device.mgt.core.service, + org.wso2.carbon.device.mgt.core.*, org.wso2.carbon.event.output.adapter.core, org.wso2.carbon.event.output.adapter.core.exception, org.wso2.carbon.core, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 68e174db3f..30a8d6fa76 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -119,9 +119,7 @@ org.wso2.carbon.device.mgt.core.* - javax.ws.rs-api, scribe;scope=compile|runtime;inline=false, - javassist;inline=false * diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java index cd0ff14a20..8843f507cc 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java @@ -102,7 +102,7 @@ public class LoginHandler extends HttpServlet { ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( HandlerConstants.PUBLISHER_APPLICATION_NAME, tagsAsStringArray, HandlerConstants.PRODUCTION_KEY, username, false, - ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD, scopeString); + ApiApplicationConstants.DEFAULT_VALIDITY_PERIOD); if (apiApplicationKey != null && getTokenAndPersistInSession(apiApplicationKey.getConsumerKey(), apiApplicationKey.getConsumerSecret(), req, resp, scopes)) { diff --git a/pom.xml b/pom.xml index e902abd70c..e3e7998167 100644 --- a/pom.xml +++ b/pom.xml @@ -661,10 +661,6 @@ commons-httpclient.wso2 commons-httpclient - - commons-httpclient.wso2 - commons-httpclient - org.wso2.carbon org.wso2.carbon.registry.api @@ -2028,8 +2024,8 @@ 2.2.1 6.1.1 - 4.6.1 - [4.6.0, 5.0.0) + 4.6.2 + [4.5.0, 5.0.0) 5.1.2 1.3 3.1.3 @@ -2057,9 +2053,9 @@ 4.8.2 - 3.6.100.v20120522-1841 + 3.6.200.v20130402-1505 3.3.100.v20120522-1822 - 3.9.1.v20130814-1242 + 3.9.1.v20140110-1610 1.2.140.wso2v3 @@ -2075,19 +2071,19 @@ 5.18.187 [5.2.0, 7.0.0) 6.4.111 - 5.4.6 + 5.5.2 1.0.31 [1.0.31, 2.0.0) - [5.7.0, 6.0.0) - [5.2.0, 7.0.0) - [5.1.0, 7.0.0) + [5.14.0, 6.0.0) + [6.0.0, 7.0.0) + [5.3.0, 6.0.0) - 4.6.11 + 4.9.10 - 4.7.23 + 4.8.21 1.2.11-wso2v10 @@ -2098,7 +2094,7 @@ 4.1.16-SNAPSHOT - 4.6.21 + 4.7.35 1.4.0.wso2v1 [1.4.0,2.0.0) 2.4.0.wso2v1 @@ -2106,8 +2102,8 @@ [2.6.0,3.0.0) - 9.0.5 - (6.0.0,10.0.0] + 9.0.174 + [9.0.0, 10.0.0) 5.1.37 @@ -2117,7 +2113,7 @@ 2.1.23 - 4.7.38 + 4.7.39 ${carbon.registry.version} [4.7.0, 5.0.0) @@ -2135,12 +2131,9 @@ 2.3.0.wso2v2 - - 2.26.1.wso2v3 - 3.0.0.wso2v1 1.3 - 2.3.1 + 2.8.5 4.6.0 1.13.0 9.3.1 @@ -2191,12 +2184,12 @@ 2.0.1 1.5.10 - 1.5.10 + 1.6.1 4.0.1 1.0.10 - 2.6.1.wso2v1 + 2.9.8.wso2v1 2.6.1.wso2v3 2.8.2.wso2v1 1.2.0.wso2v1 @@ -2220,7 +2213,7 @@ 1.7 - 2.1.7-wso2v7 + 2.1.7-wso2v227 1.5.11.wso2v15 @@ -2258,7 +2251,7 @@ 1.0 1.13.1 - 5.1.2.RELEASE + 5.1.13.RELEASE 2.7.18 [1.6.0, 2.0.0)