chore(dev): update dev environment

This commit is contained in:
MingxuanGame
2025-08-24 13:49:09 +00:00
parent 7eea68aa9a
commit 86c6c291e4
11 changed files with 538 additions and 115 deletions

View File

@@ -156,11 +156,10 @@ def create_access_token(data: dict, expires_delta: timedelta | None = None) -> s
expire = utcnow() + timedelta(minutes=settings.access_token_expire_minutes)
# 添加标准JWT声明
to_encode.update({"exp": expire, "random": secrets.token_hex(16)})
if hasattr(settings, "jwt_audience") and settings.jwt_audience:
to_encode.update({"exp": expire, "jti": secrets.token_hex(16)})
if settings.jwt_audience:
to_encode["aud"] = settings.jwt_audience
if hasattr(settings, "jwt_issuer") and settings.jwt_issuer:
to_encode["iss"] = settings.jwt_issuer
to_encode["iss"] = str(settings.server_url)
# 编码JWT
encoded_jwt = jwt.encode(to_encode, settings.secret_key, algorithm=settings.algorithm)