优化jwt验证方式

master
yutent 2024-07-11 11:47:36 +08:00
parent 655c5e34fa
commit 7fbf720e62
2 changed files with 3 additions and 3 deletions

View File

@ -30,10 +30,10 @@ export default class Controller {
let { __mix_key__ } = this.request
return this.context.$$jwt.sign(data, __mix_key__)
},
verify: () => {
verify: token => {
this.#auth = null
let token = this.request.header('authorization')
let { __mix_key__ } = this.request
token ??= this.request.header('authorization')
if (token) {
this.#auth = this.context.$$jwt.verify(token, __mix_key__)

View File

@ -1,6 +1,6 @@
{
"name": "@gm5/controller",
"version": "2.0.2",
"version": "2.0.3",
"type": "module",
"description": "控制器基类。",
"main": "index.js",