mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:33:05 +08:00
jwt_token有效期延长到10分钟,防止服务器时间误差
This commit is contained in:
@@ -36,7 +36,7 @@ class Bot < ApplicationRecord
|
||||
|
||||
def self.decode_jwt_token(token)
|
||||
decoded_token = JWT.decode token, nil, false
|
||||
return [nil, "Token已过期"] if Time.now.to_i - 60 - decoded_token[0]["exp"].to_i > 0
|
||||
return [nil, "Token已过期"] if Time.now.to_i - 10*60 - decoded_token[0]["exp"].to_i > 0
|
||||
bot = Bot.find_by(id: decoded_token[0]["iss"])
|
||||
return [nil, "Token不存在"] if bot.blank?
|
||||
rsa_private = OpenSSL::PKey::RSA.new(bot.private_key)
|
||||
|
||||
Reference in New Issue
Block a user