feat: analysis user auth and ws

This commit is contained in:
zzw
2026-10-15 09:23:07 +08:00
parent 6fa185003d
commit a65b6d2803
102 changed files with 4966 additions and 786 deletions
+20
View File
@@ -50,4 +50,24 @@ routes:
type: roundrobin
nodes:
"bff:10001": 1
- id: ws
name: ws
priority: 30
uris:
- /ws
methods:
- GET
enable_websocket: true
plugins:
cors:
allow_origins: "*"
allow_methods: "GET"
allow_headers: "Authorization,Authorization-Type,Authorization-Auth,Refresh,X-Refresh,X-Service-Code,Sec-WebSocket-Key,Sec-WebSocket-Version,Sec-WebSocket-Accept,Connection,Upgrade"
max_age: 86400
upstream:
type: roundrobin
nodes:
"ws:10002": 1
#END
+10 -2
View File
@@ -24,7 +24,12 @@ function _M.access(conf, ctx)
["/api/v3/chore/oss/upload"] = true,
["/api/v2/analysis/qrcode/generate"] = true,
["/api/v3/user/qrcode/generate"] = true,
["/api/v3/user/qrcode/scan"] = true,
["/api/v2/analysis/agreement/info"] = true,
["/api/v2/analysis/switch"] = true,
["/api/v2/analysis/user/delete"] = true,
}
local user_key = core.request.header(ctx, "authorization")
@@ -71,7 +76,7 @@ function _M.access(conf, ctx)
end
local res, err = red:get(redis_key)
core.log.error("AUTH_DEBUG host=", redis_host,
core.log.info("AUTH_DEBUG host=", redis_host,
" port=", redis_port,
" password=", redis_password,
" db=", redis_db,
@@ -143,6 +148,9 @@ function _M.access(conf, ctx)
if json.client_code then
ngx.req.set_header("X-Client-Code", tostring(json.client_code))
end
if json.biz_id then
ngx.req.set_header("X-Biz-Id", tostring(json.biz_id))
end
end
ngx.req.set_header("X-Refresh", refresh or "")