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