feat(security): add resource token authentication using HttpOnly Cookie

This commit is contained in:
InfinityPacer
2024-10-10 00:45:26 +08:00
parent e31df15b5e
commit 871f8d3529
6 changed files with 145 additions and 42 deletions
+4
View File
@@ -32,10 +32,14 @@ class ConfigModel(BaseModel):
FRONTEND_PATH: str = "/public"
# 密钥
SECRET_KEY: str = secrets.token_urlsafe(32)
# RESOURCE密钥
RESOURCE_SECRET_KEY: str = secrets.token_urlsafe(32)
# 允许的域名
ALLOWED_HOSTS: list = ["*"]
# TOKEN过期时间
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
# RESOURCE_TOKEN过期时间
RESOURCE_ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 10
# 时区
TZ: str = "Asia/Shanghai"
# API监听地址