sciagent code + Gitea Actions CI/CD
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Thinh Lam
2026-06-30 09:38:30 +07:00
commit 688fac73e9
1167 changed files with 158244 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
"""Shared JWT bearer header for route security tests (uses auth_jwt.jwt_secret())."""
from __future__ import annotations
import uuid
from datetime import datetime, timedelta, timezone
from typing import Sequence
import jwt
from src.auth_jwt import jwt_secret
def mint_bearer_token(
*,
roles: Sequence[str] = ("viewer",),
sub: uuid.UUID | None = None,
email: str = "security-test@ump.edu.vn",
credential_version: int = 0,
) -> str:
user_id = sub or uuid.uuid4()
now = datetime.now(timezone.utc)
payload = {
"sub": str(user_id),
"email": email,
"roles": list(roles),
"cv": credential_version,
"iat": int(now.timestamp()),
"exp": int((now + timedelta(hours=1)).timestamp()),
}
token = jwt.encode(payload, jwt_secret(), algorithm="HS256")
return f"Bearer {token}"