forked from Gitlink/forgeplus
add Authorization Bearer token
This commit is contained in:
parent
480bd8985a
commit
1efee8d1c4
|
|
@ -313,8 +313,13 @@ class ApplicationController < ActionController::Base
|
|||
header = request.authorization
|
||||
pattern = /^Bearer /i
|
||||
token = header.gsub(pattern, "")
|
||||
User.current, message = Bot.decode_jwt_token(token)
|
||||
tip_exception(401, message) if message.present?
|
||||
user = User.find_by(gitea_token: token)
|
||||
if user.present?
|
||||
User.current = user
|
||||
else
|
||||
User.current, message = Bot.decode_jwt_token(token)
|
||||
tip_exception(401, message) if message.present?
|
||||
end
|
||||
else
|
||||
if @doorkeeper_token.present?
|
||||
# client方法对接,需要一直带着用户标识uid
|
||||
|
|
|
|||
Loading…
Reference in New Issue