From 52fd8c4b893beb686573130124c524b0f2ce63a1 Mon Sep 17 00:00:00 2001 From: Dharmakeerthi Lasantha Date: Tue, 6 Jun 2023 17:03:33 +0530 Subject: [PATCH] Add Application key generating logic --- .../APIManagementProviderServiceImpl.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java index 67a6f21f16..238042dc24 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -126,17 +126,36 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe boolean isAllowedAllDomains, String validityTime, String password) throws APIManagerException { + APIApplicationServices apiApplicationServices = APIApplicationManagerExtensionDataHolder.getInstance().getApiApplicationServices(); ConsumerRESTAPIServices consumerRESTAPIServices = APIApplicationManagerExtensionDataHolder.getInstance().getConsumerRESTAPIServices(); + try { + consumerRESTAPIServices.getAllApplications(null, null, applicationName); - /* + List uniqueApiList = new ArrayList(); + + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); + + for (String tag: tags) { + Map queryParams = new HashMap<>(); + queryParams.put("tag", tag); + if ("carbon.super".equals(tenantDomain)) { + consumerRESTAPIServices.getAllApis(null, null, queryParams); + } else { + //call All API getting call with carbon super header param + } + + uniqueApiList.add("Test"); + Set taggedAPISet = new HashSet<>(uniqueApiList); + uniqueApiList.clear(); + uniqueApiList.addAll(taggedAPISet); + } + + consumerRESTAPIServices.getAllSubscriptions(null, null, "1"); - */ - try { - consumerRESTAPIServices.getAllApplications(null, null, null); } catch (APIServicesException e) { e.printStackTrace(); } catch (BadRequestException e) {