Improvements in App registration flow

Pasindu Rupasinghe 1 year ago
parent bc97c6e212
commit 3e4e9a2d4e

@ -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();
}

@ -43,7 +43,9 @@ import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClie
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MQTTAdapterListener implements MqttCallback, Runnable {
@ -136,7 +138,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());

@ -50,6 +50,9 @@ import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClie
import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService;
import org.wso2.carbon.user.api.UserStoreException;
import java.util.ArrayList;
import java.util.List;
/**
* MQTT publisher related configuration initialization and publishing capabilties are implemented here.
*/
@ -158,7 +161,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());

@ -79,6 +79,8 @@ public class MQTTBrokerConnectionConfiguration {
public int getQos() {
return qos;
}
public MQTTBrokerConnectionConfiguration(OutputEventAdapterConfiguration eventAdapterConfiguration,
Map<String, String> globalProperties) {
adapterName = eventAdapterConfiguration.getName();

Loading…
Cancel
Save