|
|
|
@ -46,6 +46,7 @@ import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
|
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException;
|
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
|
|
|
|
|
import org.wso2.carbon.user.api.UserStoreException;
|
|
|
|
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
@ -79,7 +80,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
|
|
|
|
InputEventAdapterListener inputEventAdapterListener) {
|
|
|
|
|
String mqttClientId = inputEventAdapterConfiguration.getProperties()
|
|
|
|
|
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID);
|
|
|
|
|
if(mqttClientId == null || mqttClientId.trim().isEmpty()){
|
|
|
|
|
if (mqttClientId == null || mqttClientId.trim().isEmpty()) {
|
|
|
|
|
mqttClientId = MqttClient.generateClientId();
|
|
|
|
|
}
|
|
|
|
|
this.inputEventAdapterConfiguration = inputEventAdapterConfiguration;
|
|
|
|
@ -185,7 +186,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
|
|
|
|
log.error("Invalid dcrUrl : " + dcrUrlString);
|
|
|
|
|
} catch (JWTClientException | UserStoreException e) {
|
|
|
|
|
log.error("Failed to create an oauth token with jwt grant type.", e);
|
|
|
|
|
} catch (NoSuchAlgorithmException |KeyManagementException |KeyStoreException | IOException e) {
|
|
|
|
|
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | IOException e) {
|
|
|
|
|
log.error("Failed to create a http connection.", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -226,7 +227,9 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
|
|
|
|
}
|
|
|
|
|
PrivilegedCarbonContext.startTenantFlow();
|
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
|
|
|
|
|
TenantAxisUtils.getTenantConfigurationContext(tenantDomain,InputAdapterServiceDataHolder.getMainServerConfigContext());
|
|
|
|
|
if (!tenantDomain.equalsIgnoreCase(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
|
|
|
|
TenantAxisUtils.getTenantConfigurationContext(tenantDomain, InputAdapterServiceDataHolder.getMainServerConfigContext());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputEventAdapterListener inputEventAdapterListener = InputAdapterServiceDataHolder
|
|
|
|
|
.getInputEventAdapterService().getInputAdapterRuntime(PrivilegedCarbonContext.getThreadLocalCarbonContext()
|
|
|
|
|