fix(auth): token 登录将令牌放入 Authorization: Bearer 头

token 换登录调上游 getTokenInfo 时参数传错:原来发静态头
Authorization: Bearer admin + 令牌放 access_token cookie。上游实际
从 Authorization: Bearer <token> 头读取令牌。

- 鉴权头改为 "Bearer "+前端传入 token,删除 access_token cookie
- service_authorization 配置项弃用(保留兼容,不再参与请求)
- 新增回归测试 test_token_login_upstream_call.py
- 同步更新 AUTH_LOGIN.md / CLAUDE.md / config.yaml 注释 / login_config 文档

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
AdministratorandClaude Opus 4.8 committed 2026-06-02 19:33:38 +08:00
1 parent 247ff86f2f
commit e1e9be8daa
7 files changed
+112 -20

No files matched your search

@@ -33,8 +33,8 @@ class TokenLoginConfig(BaseModel):
"""Token-exchange login.
The frontend passes an upstream access token via the URL. The gateway calls
``token_info_url`` with ``Authorization: <service_authorization>`` and the
token as the ``access_token`` cookie, reads ``data.username`` from the
``token_info_url`` with that token placed directly in the
``Authorization: Bearer <token>`` header, reads ``data.username`` from the
response, then signs the matching local user in (auto-registering if the
username is not yet in the database).
"""
@@ -49,7 +49,10 @@ class TokenLoginConfig(BaseModel):
)
service_authorization: str = Field(
default="Bearer admin",
description="Authorization header value used when calling token_info_url.",
description=(
"Deprecated/unused: the Authorization header is now built from the "
"caller's token as 'Bearer <token>'. Retained for backward compat."
),
)
timeout_seconds: float = Field(
default=10.0,