单元测试:新建用户与用户组
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
from models.setting import Setting
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(
|
||||
scheme_name='获取 JWT Bearer 令牌',
|
||||
@@ -6,4 +7,14 @@ oauth2_scheme = OAuth2PasswordBearer(
|
||||
tokenUrl="/api/user/session",
|
||||
)
|
||||
|
||||
SECRET_KEY = ''
|
||||
SECRET_KEY = ''
|
||||
|
||||
async def load_secret_key() -> None:
|
||||
"""
|
||||
从数据库读取 JWT 的密钥。
|
||||
|
||||
:param key: 用于加密和解密 JWT 的密钥
|
||||
:type key: str
|
||||
"""
|
||||
global SECRET_KEY
|
||||
SECRET_KEY = await Setting.get(type='auth', name='secret_key')
|
||||
Reference in New Issue
Block a user