feat: add fixed questions and improve authentication

This commit is contained in:
吉鑫升 committed 2026-08-21 17:58:39 +08:00
1 parent 8af4fed89d
commit 4c9f75f31e
42 files changed
+4008 -200

No files matched your search

@@ -15,9 +15,10 @@ import secrets
from langgraph_sdk import Auth
from app.gateway.auth.disabled_mode import get_assumed_user_for_disabled_auth, is_auth_disabled
from app.gateway.auth.errors import TokenError
from app.gateway.auth.jwt import decode_token
from app.gateway.deps import get_local_provider
from app.gateway.auth.errors import TokenError
from app.gateway.auth.jwt import decode_token
from app.gateway.auth.token_source import get_explicit_or_session_token
from app.gateway.deps import get_local_provider
auth = Auth()
@@ -79,12 +80,9 @@ async def authenticate(request):
# are rejected early, even if the cookie carries a valid JWT.
_check_csrf(request)
token = request.cookies.get("access_token")
if not token:
authorization = request.headers.get("authorization", "").strip()
scheme, _, bearer_token = authorization.partition(" ")
if scheme.lower() == "bearer" and bearer_token.strip():
token = bearer_token.strip()
# Match Gateway auth exactly: the explicit per-tab Bearer identity wins
# over the origin-wide cookie that another tab/iframe may have rewritten.
token = get_explicit_or_session_token(request)
if not token:
raise Auth.exceptions.HTTPException(