diff --git a/ruoyi-modules/hw-mqtt-broker/src/main/java/com/hw/mqtt/auth/MqttAuthHandler.java b/ruoyi-modules/hw-mqtt-broker/src/main/java/com/hw/mqtt/auth/MqttAuthHandler.java index 085d66d..9b8a918 100644 --- a/ruoyi-modules/hw-mqtt-broker/src/main/java/com/hw/mqtt/auth/MqttAuthHandler.java +++ b/ruoyi-modules/hw-mqtt-broker/src/main/java/com/hw/mqtt/auth/MqttAuthHandler.java @@ -78,16 +78,16 @@ public class MqttAuthHandler implements IMqttServerAuthHandler { //白名单过滤 if(clientIdWhitelist.contains(clientId)){ return true; - } - if(deviceInfoDtos!=null){ + }else if (deviceInfoDtos!=null){ Optional optionalDeviceInfoDto = deviceInfoDtos.stream().distinct().filter(x -> x.getDeviceCode().equals(clientId)).findFirst(); //判断本地集合中是否包含该设备信息,如果不包含再次读取Redis并初始化本地集合 if (optionalDeviceInfoDto.isPresent()) { DeviceInfoDto deviceInfo = optionalDeviceInfoDto.get(); return checkDeviceInfo(deviceInfo,clientId,userName,password); } + }else { + return NoDeviceInfoEvent(clientId,userName,password); } - return NoDeviceInfoEvent(clientId,userName,password); }catch (Exception ex){ logger.error("客户端认证逻辑处理异常:"+ex.getMessage()); }