mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
后端配置简化
This commit is contained in:
@@ -44,7 +44,6 @@ public class MQTTBootStrap {
|
||||
* 启动mqttBroker
|
||||
* @return server
|
||||
*/
|
||||
@ConditionalOnProperty(value = "server.broker.enabled", havingValue = "true")
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public Server mqttBroker() {
|
||||
return NettyConfig.custom()
|
||||
@@ -56,7 +55,6 @@ public class MQTTBootStrap {
|
||||
.build();
|
||||
}
|
||||
|
||||
@ConditionalOnProperty(value = "server.broker.enabled", havingValue = "true")
|
||||
@Bean(initMethod = "start",destroyMethod = "stop")
|
||||
public Server webSocket(){
|
||||
return NettyConfig.custom()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user