Spring Security 5.2.0.M2 已发布,该版本包含。下面说说值得关注的更新:
OAuth 2.0
- 客户端支持 PKEC
-
OpenID 连接 RP-Initiated Logout
-
能够使用 JwtDecoder 的对称密钥
-
NimbusReactiveJwtDecoder 能够采用自定义处理器
-
支持资源服务器令牌自检
-
支持资源服务器多租户(仅限 Servlet)
Core
- 将密钥材料转换为密钥实例
- 支持 JDK 12
- 引入 AuthenticationManagerResolver
- 为方法参数引入 @CurrentSecurityContext
与之前的 @AuthenticationPrincipal 一样,@CurrentSecurityContext 使用参数解析器来检索 SecurityContext 的各个方面:
public String hello(@CurrentSecurityContext SecurityContext context) { return Optional.ofNullable(context.getAuthentication()) .map(Authentication::getName).orElse("world");}// orpublic String hello(@CurrentSecurityContext (expression="authentication.name") String name) { return Optional.ofNullable(name).orElse("world");}
Web
- 支持 Clear-Site-Data 标头
- 支持 HSTS 预加载
- 引入 CompositeHeaderWriter,以及其他一些
详情可查看。
下载地址: