Repository navigation
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.
问题与验收标准
感谢 @rwzdk 在 #156 中发现并提出方法安全配置问题。本 PR 基于
dev(3395690d9fbcc46a53a40140689987b56944666a)独立准备最小修复及行为回归,保留原 PR 的发现归属;不修改原贡献分支。验收标准:两端生产安全配置能够对 Spring 管理的方法执行权限检查;无匹配权限时不调用业务依赖,有匹配权限时正常调用,未登录仍被拒绝。验证只使用无害测试 fixture,不包含真实业务接口复现步骤。
改动与兼容性
WebSecurityConfig各增加@EnableMethodSecurity(prePostEnabled = true)及对应 import。生产代码共增加 4 行。MethodSecurityHttpTest,加载真实安全配置、FilterChainProxy、Spring MVC 和BizExceptionResolver,通过 MockMvc 请求 Spring 管理的 fixture;没有在测试配置中另行启用方法安全,也不是直接调用 Controller 或只反射检查注解。BizExceptionResolver返回 HTTP 200 + 业务码 5004;未登录由认证入口返回 HTTP 401。这里不将方法拒绝改成 HTTP 403。验证
环境:JDK 17、Maven 3.9.11。
hasAnyAuthority任一匹配时恰调用一次,匿名请求 401。clean test:15 个测试类、62 例全部通过,0 失败、0 错误、0 跳过,10 个 reactor 模块成功。完整结果包含另外 11 个既有商户配置 Mockito 回归。docs/install/test_*.sh三项断言及安装/卸载脚本bash -n检查通过;补丁与空白检查通过。本地实际 Maven 执行另外使用
-o、独立依赖缓存,并通过-DargLine=-javaagent:<本地缓存>/net/bytebuddy/byte-buddy-agent/1.14.19/byte-buddy-agent-1.14.19.jar在测试 JVM 启动时加载 agent,以适配不支持 Mockito 自附加的容器;没有修改仓库依赖或 CI 流程。未验证:fixture 认证通过请求属性上下文注入,不覆盖真实 JWT 解析、登录/令牌缓存生命周期、实际角色权限矩阵、真实业务端点或完整部署启动。没有连接真实数据库、Redis、MQ 或支付渠道;测试通过不代表真实支付或部署验收完成。远端 CI 结果以本 PR 当前 head 的检查为准。
合并前核对
dev本 PR 保持草稿,供评审;不是发布 PR。