feat: let administrators view and copy encrypted integration credentials

This commit is contained in:
2026-09-27 13:48:26 +08:00
parent 5555a7b342
commit d54bdd9847
38 changed files with 905 additions and 71 deletions

View File

@@ -32,6 +32,7 @@ type AccessQueue struct {
// AccessCredential 是脱敏的凭据元数据,绝不返回秘密或秘密摘要。
type AccessCredential struct {
TokenStored bool `json:"token_stored"` // TokenStored 当前 Token 是否已加密保存;列表不会返回秘密。
PreviousValidUntil *time.Time `json:"previous_valid_until,omitempty"` // PreviousValidUntil 上一代令牌实际截止,空表示无旧令牌。
ID core.ID `json:"id"` // ID 凭据标识,重新生成 Token 时不改变。
Name string `json:"name"` // Name 凭据名称。
@@ -43,10 +44,11 @@ type AccessCredential struct {
// ApplicationDetail 展示一个命名空间的队列和凭据,读取量有界。
type ApplicationDetail struct {
Entry ApplicationEntry `json:"entry"` // Entry 当前应用与环境。
Queues []AccessQueue `json:"queues"` // Queues 最多 100 个队列。
Credentials []AccessCredential `json:"credentials"` // Credentials 最多 100 张凭据。
Truncated bool `json:"truncated"` // Truncated 为真时不得把当前结果解释为完整清单。
TokenVaultEnabled bool `json:"token_vault_enabled"` // TokenVaultEnabled 当前节点是否配置了凭据保管密钥。
Entry ApplicationEntry `json:"entry"` // Entry 当前应用与环境。
Queues []AccessQueue `json:"queues"` // Queues 最多 100 个队列。
Credentials []AccessCredential `json:"credentials"` // Credentials 最多 100 张凭据。
Truncated bool `json:"truncated"` // Truncated 为真时不得把当前结果解释为完整清单。
}
// ApplicationInput 描述创建应用或变更凭据的管理员意图。
@@ -65,7 +67,7 @@ type ApplicationInput struct {
Reason string `json:"reason"` // Reason 写入审计的变更原因。
}
// ApplicationOperation 是浏览器在提交前保存的固定操作;Token 不写入数据库。
// ApplicationOperation 是浏览器在提交前保存的固定操作;启用保管时仅保存 Token 密文。
// 网络结果未知时重放同一份内容,禁止重新生成操作身份或秘密。
type ApplicationOperation struct {
Version int `json:"version,omitempty"` // Version v2 支持长期令牌与过渡;旧固定操作未设置时沿用 v1。
@@ -75,7 +77,7 @@ type ApplicationOperation struct {
NamespaceID core.ID `json:"namespace_id"` // NamespaceID 固定命名空间标识。
QueueID core.ID `json:"queue_id,omitempty"` // QueueID 新建应用的初始队列。
CredentialID core.ID `json:"credential_id"` // CredentialID 固定凭据身份。
Token string `json:"token,omitempty"` // Token 一次性交付的秘密,只留在调用方内存或私密下载文件。
Token string `json:"token,omitempty"` // Token 当前秘密;服务端启用保管后加密保存,不能进入日志。
ExpiresAt *time.Time `json:"expires_at,omitempty"` // ExpiresAt 固定到期时间,空表示长期或不适用。
PreviousValidUntil *time.Time `json:"previous_valid_until,omitempty"` // PreviousValidUntil ROTATE 固定过渡截止。
}