修改token增加bearer后验证问题
This commit is contained in:
parent
64b4e82145
commit
eb4228a200
|
|
@ -1,5 +1,5 @@
|
|||
local jwt = require "resty.jwt"
|
||||
local validators = require "resty.jwt-validators"
|
||||
local cjson = require("cjson.safe")
|
||||
local conf = require("config")
|
||||
|
||||
-- 定义一个JSON Schema
|
||||
|
|
@ -29,7 +29,7 @@ if token == nil then
|
|||
end
|
||||
|
||||
--校验令牌
|
||||
local jwt_obj = jwt:verify(conf.secret_key, auth_header)
|
||||
local jwt_obj = jwt:verify(conf.secret_key, token)
|
||||
--如果校验结果中的verified==false,则表示令牌无效
|
||||
if jwt_obj.verified == false then
|
||||
ngx.log(ngx.WARN, "Invalid token: ".. jwt_obj.reason)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ function _M.authorizationToken(auth_header)
|
|||
end
|
||||
|
||||
--校验令牌
|
||||
local jwt_obj = jwt:verify(conf.secret_key, auth_header)
|
||||
local jwt_obj = jwt:verify(conf.secret_key, token)
|
||||
--如果校验结果中的verified==false,则表示令牌无效
|
||||
if jwt_obj.verified == false then
|
||||
response["code"] = 401
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user