From 222201ef5bc8799b0f85ae6823e087d590ce5230 Mon Sep 17 00:00:00 2001 From: Wen JY Date: Thu, 14 Sep 2023 09:07:31 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20broker=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=AE=A4=E8=AF=81=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hw/mqtt/auth/MqttAuthHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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()); }