✨ 实现客户端凭据生命周期与紧急撤销 - #3
Merged
Merged
Conversation
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.
概要
第三轮改造客户端凭据生命周期与紧急撤销。保留现有 Revision 审批、管理会话、CSRF、OIDC 登录和 scrypt 格式,不引入旧库迁移或范围外能力。
数据模型
oidc_clients移除 Secret 摘要,新建oidc_client_secrets,记录secret_id、客户端、scrypt 摘要、active/retiring/revoked、创建/到期/撤销时间和版本。oidc_artifacts增加基于现有 Artifact HMAC 密钥的不可逆client_id_hash索引。authorization_generation,将签发请求绑定到撤销前读取的授权代际。secret_id和轮换、指定撤销、授权撤销、紧急停用操作,不记录 Secret 明文或摘要。Secret 状态机
API 与 OIDC
POST /clients/:clientId/secrets/rotatePOST /clients/:clientId/secrets/:secretId/revokePOST /clients/:clientId/authorizations/revokePOST /clients/:clientId/disable升级为原子紧急停用、撤销全部 Secret/授权并取消开放 Revision。now()下尚未到期的 retiring Secret,不加载历史摘要。安全设计
now()生成轮换创建时间、宽限期、到期判断和冷却判断,避免多实例应用时钟偏差。界面与文档
验证结果
pnpm format:通过pnpm lint:通过TEST_DATABASE_URL=postgres://postgres:test@127.0.0.1:55432/cqut_auth_test pnpm test:服务端 154/154,通过且 0 跳过;管理 UI 8/8 通过pnpm build:通过pnpm docker:build:通过pnpm docker:up+/health/ready:PostgreSQL、Redis、OIDC 服务均 healthy,readiness 返回 database=postgres、redis=ready;随后pnpm docker:down正常关闭审查修复验证
OidcPersistenceImpl+ PostgreSQL 完成 Authorization Code + PKCE、Access/Refresh 签发、HMAC Client Hash 数据库断言、客户端撤销、UserInfo/Refresh 失效和 OP Session 复用。created_at与expires_at来自数据库时间。