后端配置简化

This commit is contained in:
kerwincui
2025-05-15 12:07:16 +08:00
parent 7079610ee4
commit 7f58d3e12b
7 changed files with 16 additions and 26 deletions

View File

@@ -36,8 +36,7 @@ public class AuthService {
// 令牌秘钥
@Value("${token.secret}")
private String secret;
@Value("${server.broker.must-pass}")
private boolean mustPass;
/**
* MQTT客户端认证
@@ -48,8 +47,6 @@ public class AuthService {
* @return 结果
*/
public boolean auth(String clientId, String username, String password) {
//不需要账号密码校验,直接返回true
if (!mustPass) return true;
if (StringUtils.isEmpty(clientId) || StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
log.error("=>客户端参数缺少,clientId:{},username:{},password:{}", clientId, username, password);
return false;

View File

@@ -26,8 +26,7 @@ public class MqttRemoteManager {
/**
* true: 使用netty搭建的mqttBroker false: 使用emq
*/
@Value("${server.broker.enabled}")
private Boolean enabled;
private Boolean enabled = true;
@Resource
private PubMqttClient pubMqttClient;