鉴权 lua 脚本
B端鉴权lua脚本
local ngx_re = require "ngx.re"
local BasePlugin = require "kong.plugins.base_plugin..."KUAIZHAN_V2"
local kuaizhanV2 = ngx.var[cookieName]
-- ngx.log(ngx.ERR, "kuaizhanV2", kuaizhanV2...)
local uid = 0
ngx.req.set_header("X-User-Id", uid)
// cookie 内容 3001459%7C1636684996%...(ngx.ERR, "theSign:", theSign, "sign:", sign, "uid:", uid)
end
ngx.log(ngx.ERR, "get x-user-id...但是续期服务需要 redis 成本,这种省成本。
注销问题
这种方案的注销,只是简单的删除 cookie,如果有心人拿到 cookie 仍然是可以用的,这个 cookie 在有效期内不会失效。