Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
520e6002
提交
520e6002
authored
11月 18, 2022
作者:
林振杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改mqtt连接验证
上级
25e65dd9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
11 行删除
+13
-11
MqttController.java
.../glinfo/enbao/modules/mqtt/controller/MqttController.java
+8
-6
application-test.yml
appapi/src/main/resources/application-test.yml
+5
-5
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/mqtt/controller/MqttController.java
浏览文件 @
520e6002
...
...
@@ -8,10 +8,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
tech.glinfo.enbao.common.annotation.Login
;
import
tech.glinfo.enbao.common.utils.ByteUtils
;
import
tech.glinfo.enbao.common.utils.EncryptUtil
;
import
tech.glinfo.enbao.common.utils.R
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
import
tech.glinfo.enbao.common.utils.*
;
import
tech.glinfo.enbao.config.MqttGateway
;
import
tech.glinfo.enbao.modules.mqtt.entity.AuthEntity
;
...
...
@@ -27,11 +24,16 @@ public class MqttController {
private
MqttGateway
mqttGateway
;
@PostMapping
(
"auth"
)
public
ResponseEntity
<
Object
>
auth
(
AuthEntity
auth
){
public
ResponseEntity
<
Object
>
auth
(
@RequestBody
AuthEntity
auth
){
log
.
info
(
"请求参数:{}"
,
auth
);
String
pwd
=
EncryptUtil
.
encrypt
(
auth
.
getUsername
());
if
(
auth
.
getPassword
()
!=
null
&&
auth
.
getPassword
().
equals
(
pwd
))
{
return
new
ResponseEntity
<
Object
>(
HttpStatus
.
OK
);
boolean
isSuperuser
=
false
;
if
(
auth
.
getUsername
().
startsWith
(
"168EG"
))
{
//暂时写死
isSuperuser
=
true
;
}
MapUtils
rtn
=
new
MapUtils
().
put
(
"result"
,
"allow"
).
put
(
"is_superuser"
,
isSuperuser
);
return
new
ResponseEntity
<
Object
>(
rtn
,
HttpStatus
.
OK
);
}
else
{
return
new
ResponseEntity
<
Object
>(
"auth deny!"
,
HttpStatus
.
UNAUTHORIZED
);
}
...
...
appapi/src/main/resources/application-test.yml
浏览文件 @
520e6002
...
...
@@ -3,7 +3,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
#172.19.211.93
url
:
jdbc:mysql://192.168.0.
164
:3306/glinfo?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://192.168.0.
26
:3306/glinfo?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username
:
root
password
:
Glinfo#123456!
initial-size
:
10
...
...
@@ -36,7 +36,7 @@ spring:
redis
:
open
:
true
# 是否开启redis缓存 true开启 false关闭
database
:
0
host
:
192.168.0.
164
host
:
192.168.0.
26
port
:
6379
password
:
# 密码(默认为空)
timeout
:
6000ms
# 连接超时时长(毫秒)
...
...
@@ -49,7 +49,7 @@ spring:
#MQ配置
activemq
:
broker-url
:
failover:(tcp://106.14.139.199:61617,tcp://106.14.139.199:61618)
broker-url
:
tcp://192.168.0.26:61616
user
:
admin
password
:
admin123!
in-memory
:
false
#是否启用内存模式(就是不安装MQ,项目启动时同时启动一个MQ实例)
...
...
@@ -62,12 +62,12 @@ spring:
#mqtt配置
mqtt
:
url
:
tcp://mqtt.gonglian.info:1883
username
:
002WX
212230209
username
:
168EG
212230209
password
:
nfefhjljt
client
:
id
:
'
iotclientid${random.int}'
default
:
topic
:
$share/
api/sys/+/+/up,$share/api/sys/+/+/response
topic
:
$share/
glapi/sys/+/+/up,$share/glapi/sys/+/+/response,$share/glapi/$SYS/brokers/+/clients/#
completionTimeout
:
3000
##多数据源的配置
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论