From a64379a6bb3d25a33538d6e4269155a5c169c783 Mon Sep 17 00:00:00 2001 From: pasindu Date: Mon, 25 Sep 2023 10:04:32 +0530 Subject: [PATCH] Improvements in App registration flow --- .../api/service/impl/VirtualFireAlarmServiceImpl.java | 3 ++- .../plugins/input/adapter/mqtt/util/MQTTAdapterListener.java | 3 ++- .../plugins/output/adapter/mqtt/util/MQTTAdapterPublisher.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/io.entgra.device.mgt.plugins.virtualfirealarm.api/src/main/java/io/entgra/device/mgt/plugins/virtualfirealarm/api/service/impl/VirtualFireAlarmServiceImpl.java b/components/device-types/virtual-fire-alarm-plugin/io.entgra.device.mgt.plugins.virtualfirealarm.api/src/main/java/io/entgra/device/mgt/plugins/virtualfirealarm/api/service/impl/VirtualFireAlarmServiceImpl.java index 5482bd119..0fb3e9534 100644 --- a/components/device-types/virtual-fire-alarm-plugin/io.entgra.device.mgt.plugins.virtualfirealarm.api/src/main/java/io/entgra/device/mgt/plugins/virtualfirealarm/api/service/impl/VirtualFireAlarmServiceImpl.java +++ b/components/device-types/virtual-fire-alarm-plugin/io.entgra.device.mgt.plugins.virtualfirealarm.api/src/main/java/io/entgra/device/mgt/plugins/virtualfirealarm/api/service/impl/VirtualFireAlarmServiceImpl.java @@ -230,7 +230,8 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( VirtualFireAlarmConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true, - VirtualFireAlarmConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD, null); + VirtualFireAlarmConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD, null, null, null, + null, true); } finally { PrivilegedCarbonContext.endTenantFlow(); } diff --git a/components/extensions/cdmf-transport-adapters/input/io.entgra.device.mgt.plugins.input.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/input/adapter/mqtt/util/MQTTAdapterListener.java b/components/extensions/cdmf-transport-adapters/input/io.entgra.device.mgt.plugins.input.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/input/adapter/mqtt/util/MQTTAdapterListener.java index a4012f4ff..9b3530e45 100644 --- a/components/extensions/cdmf-transport-adapters/input/io.entgra.device.mgt.plugins.input.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/input/adapter/mqtt/util/MQTTAdapterListener.java +++ b/components/extensions/cdmf-transport-adapters/input/io.entgra.device.mgt.plugins.input.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/input/adapter/mqtt/util/MQTTAdapterListener.java @@ -136,7 +136,8 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX + mqttBrokerConnectionConfiguration.getAdapterName(); DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username, - "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, password); + "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, + password, null, null); String accessToken = getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret()); connectionOptions.setUserName(accessToken.substring(0, 18)); connectionOptions.setPassword(accessToken.substring(19).toCharArray()); diff --git a/components/extensions/cdmf-transport-adapters/output/io.entgra.device.mgt.plugins.output.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/output/adapter/mqtt/util/MQTTAdapterPublisher.java b/components/extensions/cdmf-transport-adapters/output/io.entgra.device.mgt.plugins.output.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/output/adapter/mqtt/util/MQTTAdapterPublisher.java index f4f5119b9..7a42507c7 100644 --- a/components/extensions/cdmf-transport-adapters/output/io.entgra.device.mgt.plugins.output.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/output/adapter/mqtt/util/MQTTAdapterPublisher.java +++ b/components/extensions/cdmf-transport-adapters/output/io.entgra.device.mgt.plugins.output.adapter.mqtt/src/main/java/io/entgra/device/mgt/plugins/output/adapter/mqtt/util/MQTTAdapterPublisher.java @@ -158,7 +158,8 @@ public class MQTTAdapterPublisher { String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX + mqttBrokerConnectionConfiguration.getAdapterName(); DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username, - "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, password); + "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, + password, null, null); return getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret()); // connectionOptions.setUserName(accessToken.substring(0, 18)); // connectionOptions.setPassword(accessToken.substring(19).toCharArray());