feat(server): add trusted auth mode for tenant headers#868
Merged
Conversation
|
Failed to generate code suggestions for PR |
qin-ctx
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trusted 模式多租户访问设计方案
Summary
新增一个独立于现有 dev 模式和 api_key 模式的 trusted 认证模式,用于“受信任网络中的无 key 多
租户访问”。在该模式下,服务端不要求 X-API-Key,而是要求请求显式携带 X-OpenViking-Account、
X-OpenViking-User,并可选携带 X-OpenViking-Agent。服务端直接基于这些请求头构造
RequestContext,从而复用现有的数据隔离、文件系统路径隔离、VectorDB tenant filter 和
session/resource/search 等业务链路。
v1 明确不做 account/user 自动创建,不写 accounts.json、users.json,也不让 trusted 模式承担
Admin 管理面职责。这样可以避免引入创建竞态、分布式一致性、缓存失效和注册表膨胀问题,同时满
足“无需显式创建 account/user,也无需传 api key”的核心目标。
Key Changes
1. 认证模式与配置
径。
警日志
2. 身份解析与 RequestContext
续链路无需改动
3. 数据面行为
要求存在于 accounts.json/users.json
4. Admin 与权限边界
get_request_context 的接口
模式
5. 客户端与 HTTP 约定
Test Plan
配置与启动
身份解析
数据面接口
权限边界
回归验证
Assumptions and Defaults