100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fixed bug where additional InterceptHandler added wasn't properly added to MQTT server of Moquette
Michael Rademaker6d183584c87b
diff --git a/manager/src/main/java/org/openremote/manager/mqtt/EventInterceptHandler.java b/manager/src/main/java/org/openremote/manager/mqtt/EventInterceptHandler.javaindex 13d74d47d..2e591c9a4 100644--- a/manager/src/main/java/org/openremote/manager/mqtt/EventInterceptHandler.java+++ b/manager/src/main/java/org/openremote/manager/mqtt/EventInterceptHandler.java@@ -26,7 +26,6 @@ import org.keycloak.adapters.rotation.AdapterTokenVerifier;import org.keycloak.common.VerificationException;import org.keycloak.representations.AccessToken;import org.openremote.container.message.MessageBrokerService;-import org.openremote.container.security.ClientCredentialsAuthForm;import org.openremote.container.security.keycloak.AccessTokenAuthContext;import org.openremote.container.util.UniqueIdentifierGenerator;import org.openremote.container.web.ConnectionConstants;diff --git a/manager/src/main/java/org/openremote/manager/mqtt/MqttBrokerService.java b/manager/src/main/java/org/openremote/manager/mqtt/MqttBrokerService.javaindex 6309a79b0..5d6e4b27e 100644--- a/manager/src/main/java/org/openremote/manager/mqtt/MqttBrokerService.java+++ b/manager/src/main/java/org/openremote/manager/mqtt/MqttBrokerService.java@@ -70,7 +70,6 @@ public class MqttBrokerService implements ContainerService {protected ORAuthorizatorPolicy mainAuthorizatorPolicy;protected Map<String, MqttConnection> mqttConnectionMap;- protected List<InterceptHandler> interceptHandlers;protected boolean active;protected String host;@@ -89,7 +88,6 @@ public class MqttBrokerService implements ContainerService {mainAuthorizatorPolicy = new ORAuthorizatorPolicy();mqttConnectionMap = new HashMap<>();- interceptHandlers = new ArrayList<>();clientEventService = container.getService(ClientEventService.class);ManagerIdentityService identityService = container.getService(ManagerIdentityService.class);@@ -141,7 +139,7 @@ public class MqttBrokerService implements ContainerService {properties.setProperty(BrokerConstants.HOST_PROPERTY_NAME, host);properties.setProperty(BrokerConstants.PORT_PROPERTY_NAME, String.valueOf(port));properties.setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, String.valueOf(false));- interceptHandlers.add(new EventInterceptHandler(identityProvider, messageBrokerService, mqttConnectionMap));+ List<? extends InterceptHandler> interceptHandlers = Collections.singletonList(new EventInterceptHandler(identityProvider, messageBrokerService, mqttConnectionMap));AssetStorageService assetStorageService = container.getService(AssetStorageService.class);mainAuthorizatorPolicy.addAuthorizatorPolicy(new KeycloakAuthorizatorPolicy(identityProvider, assetStorageService, clientEventService, mqttConnectionMap));@@ -185,7 +183,7 @@ public class MqttBrokerService implements ContainerService {}public MqttBrokerService addInterceptHandler(InterceptHandler interceptHandler) {- interceptHandlers.add(interceptHandler);+ mqttBroker.addInterceptHandler(interceptHandler);return this;}