From 47bc27a36d7b24e285bdc24061274ef7a177852c Mon Sep 17 00:00:00 2001 From: pasindu Date: Thu, 15 Feb 2024 15:18:40 +0530 Subject: [PATCH] Minor fixes in application registration flow --- .../extension/APIManagementProviderServiceImpl.java | 12 +++++++----- .../keymgt/extension/service/KeyMgtServiceImpl.java | 3 ++- 2 files changed, 9 insertions(+), 6 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 837a1b902c..d3f54d1247 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 @@ -112,12 +112,14 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } Map uniqueApiSet = new HashMap<>(); - for (String tag : tags) { - Map queryParams = new HashMap<>(); - queryParams.put("tag", tag); + if (tags != null) { + for (String tag : tags) { + Map queryParams = new HashMap<>(); + queryParams.put("tag", tag); - APIInfo[] apiInfos = consumerRESTAPIServices.getAllApis(apiApplicationInfo, queryParams, headerParams); - Arrays.stream(apiInfos).forEach(apiInfo -> uniqueApiSet.putIfAbsent(apiInfo.getName(), apiInfo)); + APIInfo[] apiInfos = consumerRESTAPIServices.getAllApis(apiApplicationInfo, queryParams, headerParams); + Arrays.stream(apiInfos).forEach(apiInfo -> uniqueApiSet.putIfAbsent(apiInfo.getName(), apiInfo)); + } } List uniqueApiList = new ArrayList<>(uniqueApiSet.values()); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java index 5afd9dbc65..b6e1e70ca4 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java @@ -135,7 +135,8 @@ public class KeyMgtServiceImpl implements KeyMgtService { //todo --> can use requestingUserAccessToken token here to get application data - modify getApplication // method signature - io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application application = getApplication(clientName, owner); + io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application application = + getApplication(clientName, requestingUserAccessToken); String applicationUUID = application.getApplicationId(); // do app key mapping