Repository navigation
fix(token)!: 修复用户索引清理与续期,统一 OAuth2 注入 - #392
Merged
Merged
Conversation
以游标扫描和独立对账回收用户索引,读取不再执行写后恢复。 续期校验签发快照,签发统一有效期与永久令牌 TTL,并释放自有订阅。
移除内部创建用户令牌管理器的构造入口及所有权分支,由宿主配置和销毁共享实例。迁移测试,并验证真实 Spring 装配和容器关闭释放订阅。 BREAKING CHANGE: 移除 RedisAccessTokenManager(ReactiveRedisConnectionFactory),调用方须显式传入 Redis operations 和 UserTokenManager,并管理所创建资源的生命周期。
等待源端 doFinally 完成后再检查凭证清理,避免终止信号先到达 StepVerifier 时产生竞态;保留全部清理断言和生产逻辑。
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.
Token Hash 自然过期后,用户 Set 索引仍会残留。本次完善
checkExpiredToken()的渐进对账与有界并发,并将按用户查询收敛为只读,避免短路取消截断索引恢复。同 Key Lua 校验身份、签发时间和闲置超时快照后才续期,防止重建已删除记录或覆盖重签会话;签发事件调整有效期后同步缓存快照,永久重签清除旧 TTL。
RedisUserTokenManager.close()释放自身后台订阅。OAuth2 统一显式注入共享
UserTokenManager,创建、配置与销毁由宿主负责。删除内部创建 manager 的构造路径,以及对应的所有权字段、AutoCloseable/close();默认 Spring 自动装配已使用注入方式。兼容影响:移除公开构造器
RedisAccessTokenManager(ReactiveRedisConnectionFactory)。 依赖它的调用方须改为传入 Redis operations 和UserTokenManager,手动装配时负责关闭自己创建的 manager。Redis key 格式和UserTokenManager方法签名保持不变;getByUserId()不再顺带维护索引,宿主应周期调用checkExpiredToken()。验证:
install成功:真实 Redis 清理/续期回归 16 项、OAuth2 共享装配 1 项、既有 OAuth2 端点集成 7 项,共 24 项通过、0 跳过。doFinally与测试线程的竞态,不改变生产语义。@Ignore保持不变,未计入通过数。test.redis.port=6379。索引仍为多 Key 最终一致维护;未进行现场容量、Redis Cluster 全主节点扫描或跨进程集群切换验收。Maven 制品仅本地安装,未远端发布或部署。
配套认证调度(Draft):https://github.com/jetlinks-v2/authentication-manager/pull/419
方案与验收记录:https://github.com/jetlinks-v2/cloud.jetlinks/pull/308