chore: initial commit — leaudit-platform project skeleton

17-table PostgreSQL schema with full Chinese column comments,
FastAPI project structure (admin/common/modules),
DSL rule files, and schema migration scripts.
This commit is contained in:
wren
2026-04-27 16:48:22 +08:00
commit 535d97a70c
142 changed files with 25219 additions and 0 deletions
@@ -0,0 +1,23 @@
"""JWT 鉴权工具。"""
from __future__ import annotations
from typing import Any
import jwt
from fastapi import Request
from fastapi_admin.config import JWT_SECRET_KEY, JWT_ALGORITHM
def verify_access_token(RequestObj: Request) -> dict[str, Any]:
"""验证 JWT access token 并返回 payload。"""
auth = RequestObj.headers.get("Authorization", "")
if not auth.startswith("Bearer "):
return {}
token = auth.removeprefix("Bearer ").strip()
try:
payload = jwt.decode(token, JWT_SECRET_KEY, algorithms=[JWT_ALGORITHM])
return payload
except jwt.PyJWTError:
return {}