auth token 接入验证登录接口

This commit is contained in:
xiaoxiaoqiong 2022-06-27 18:05:46 +08:00
parent 5c793088fa
commit 41eedff819
2 changed files with 3 additions and 2 deletions

View File

@ -170,7 +170,8 @@ class ApplicationController < ActionController::Base
# 未授权的捕捉407弹试用申请弹框
def require_login
#6.13 -hs
tip_exception(401, "请登录后再操作") unless valid_doorkeeper_token?
User.current = User.find_by(id: @doorkeeper_token.resource_owner_id)
tip_exception(401, "请登录后再操作") unless User.current.logged?
end

View File

@ -516,7 +516,7 @@ Doorkeeper::JWT.configure do
user = User.find(opts[:resource_owner_id])
{
iss: 'My App',
iss: 'GitLink',
iat: Time.current.utc.to_i,
# @see JWT reserved claims - https://tools.ietf.org/html/draft-jones-json-web-token-07#page-7