修改refresh刷新生成问题
This commit is contained in:
parent
5095f35e12
commit
2d8459e093
|
|
@ -100,6 +100,7 @@ local function authorizatePassword(args)
|
|||
resp:send(result)
|
||||
return
|
||||
end
|
||||
print("验证用户名和密码: ", args.username)
|
||||
-- 3.对当前用户的持有的应用程序进行验证
|
||||
local userid = res[1].id
|
||||
local client_id = args.client_id
|
||||
|
|
@ -203,12 +204,14 @@ local function authorizateRefresh(args)
|
|||
return
|
||||
end
|
||||
-- 2.验证并消费 refresh_token(滚动刷新:生成新的 rt)
|
||||
--print("begin consume token:", args.client_id)
|
||||
local rt_data, err = client.consumeRefreshToken(args.refresh_token, args.client_id, true)
|
||||
if not rt_data then
|
||||
ngx.log(ngx.ERR, "refresh_token 验证失败: ", err)
|
||||
ngx.exit(ngx.HTTP_BAD_REQUEST)
|
||||
end
|
||||
-- 3.生成新 Access Token
|
||||
--print("begin generate token:", rt_data.scope, args.client_id)
|
||||
local priv_key = conf.secret_key
|
||||
local new_access_token = token.generate_access_token(priv_key, rt_data.sub, args.client_id, rt_data.scope)
|
||||
--存储到redis中,并设置有效期时间
|
||||
|
|
@ -258,6 +261,7 @@ function _M:token()
|
|||
end
|
||||
|
||||
local grant_type = args.grant_type
|
||||
--print("grant_type类型: ", grant_type)
|
||||
if grant_type == "password" then
|
||||
authorizatePassword(args)
|
||||
elseif grant_type == "authorization_code" then
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user