modify: auth插件拆分,将token签发部分交给网关

This commit is contained in:
2026-09-10 16:43:43 +08:00
parent 5ec90a5575
commit c139b0c1d3
23 changed files with 691 additions and 290 deletions
+4 -7
View File
@@ -1,14 +1,13 @@
from typing import Any
from chongming_config import get_config
from chongming_jwt import JWT
from chongming_database import Database
from .models import *
def set_global_var(name: str, value: Any) -> None:
"""
设置当前模块的全局变量。
Args:
name: 变量名(字符串)
value: 任意值
@@ -19,11 +18,9 @@ config = get_config()
db: Database | None = None
secret = config["security"]["secret_key"]
algorithm = config["security"]["algorithm"]
jwt = JWT(secret, algorithm)
# JWT 签发已随登录内置到网关(chongming.app.routes.auth / chongming_auth 包),
# 插件不再持有 jwt 实例
__all__ = [
"db",
"jwt"
]
]