feat: show application ownership and scoped console management

This commit is contained in:
2026-09-27 12:12:46 +08:00
parent ed17713ea1
commit 1f2e7230dc
26 changed files with 757 additions and 47 deletions

View File

@@ -19,6 +19,23 @@ type Token struct {
CredentialID core.ID
// Digest 来自原始秘密的摘要,不包含可重放的原始秘密。
Digest core.Digest
// Console 仅由服务端控制台桥接器设置,Parse 永远不从外部令牌读取。
Console *ConsoleIdentity
}
// ConsoleIdentity 保留跨应用管理请求的原始会话身份;每个业务事务必须重新核验。
type ConsoleIdentity struct {
SessionNamespaceID core.ID // SessionNamespaceID 登录会话原有范围,不随页面筛选改变。
Username string // Username 部署指定的单管理员账号,不能来自请求参数。
UserID core.ID // UserID 已解析的人类账号;事务中仍核对当前会话归属。
}
// ActorID 为业务审计提供实际操作者,不把跨应用操作记成目标应用的 SDK。
func (t Token) ActorID() string {
if t.Console != nil {
return "console:" + string(t.Console.UserID)
}
return string(t.CredentialID)
}
func Issue(namespace, credential core.ID) (string, core.Digest, error) {