Spring Security 5.2.0.M2 发布,Spring 安全框架

  

Spring Security 5.2.0.M2 已发布,该版本包含超过 100 处更新。下面说说值得关注的更新:

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");
}

// or

public String hello(@CurrentSecurityContext
        (expression="authentication.name") String name) {
    return Optional.ofNullable(name).orElse("world");
}

Web

  • 支持 Clear-Site-Data 标头
  • 支持 HSTS 预加载
  • 引入 CompositeHeaderWriter,以及其他一些 header-writing cleanup

详情可查看发布说明

下载地址:

Source code(zip)

Source code(tar.gz)

猜你喜欢

转载自www.oschina.net/news/105970/spring-security-5-2-0-m2-released