|
此版本仍在开发中,尚未被视为稳定版本。如需最新稳定版本,请使用 Spring Security 7.0.4! |
Spring Security 7.0 的新功能
Spring Security 7.0 提供了多项新功能。
以下是该版本的主要亮点,或您可查看 发行说明 以获取每个特性和修复的详细列表。
模块
-
The Spring Security Kerberos 扩展 现已集成到 Spring Security 中。请参阅参考文档中的 Kerberos 部分以获取详细信息。
-
Spring授权服务器现在是Spring Security的一部分。请参见参考文档中的OAuth 2.0授权服务器部分以获取详细信息。
核心
-
已添加对
多因素认证
的支持 -
移除了
AuthorizationManager#check方法,改为使用AuthorizationManager#authorize方法 -
已添加
AllAuthoritiesAuthorizationManager和AllAuthoritiesReactiveAuthorizationManager,以及用于 授权HttpServletRequests和 方法安全表达式 的相应方法。 -
已添加
AuthorizationManagerFactory,用于在基于请求和基于方法的授权组件中创建AuthorizationManager实例 -
已添加
Authentication.Builder用于变异和合并Authentication实例 -
已将访问控制API(
AccessDecisionManager、AccessDecisionVoter等)移至新模块spring-security-access
配置
-
已从
and()DSL 中移除HttpSecurity,建议使用 lambda 方法。 -
移除了
authorizeRequests方法,改为使用authorizeHttpRequests方法 -
简化表达式迁移for
authorizeRequests -
已添加对基于SPA的CSRF配置的支持
-
已添加对将缺失的权限绑定到身份验证机制的支持。
- Java
-
http.csrf((csrf) -> csrf.spa());
加密
-
添加了基于Password4j的密码编码器,提供了流行哈希算法的替代实现:
-
Argon2Password4jPasswordEncoder- Argon2 -
BcryptPassword4jPasswordEncoder- BCrypt -
ScryptPassword4jPasswordEncoder- SCrypt -
Pbkdf2Password4jPasswordEncoder- PBKDF2 -
BalloonHashingPassword4jPasswordEncoder- Balloon Hashing
-
OAuth 2.0
-
已移除密码授予支持
-
已为HTTP 服务客户端添加 OAuth2 支持
-
在
JwkSource中添加了对自定义的NimbusJwtDecoder的支持,允许使用Nimbus的JwkSourceBuilderAPI。 -
添加了对
NimbusJwtEncoder的构建器支持,允许指定EC或RSA密钥对或秘密密钥 -
在类型级别支持
@ClientRegistrationId,消除了方法级别的重复 -
已添加对OAuth 2.0 动态注册协议的支持
-
启用默认的OAuth 2.0授权服务器中的PKCE
SAML 2.0
-
基于
AssertingPartyDetails类移除了API方法,转而使用AssertingPartyMetadata接口 -
从
Saml2AuthenticationTokenConverter中移除了对 GET 请求的支持 -
添加了基于JDBC的
AssertingPartyMetadataRepository -
使其实现即使验证失败也能仍然返回
<saml2:LogoutResponse> -
已移除对Open SAML 4的支持;应用程序应迁移到Open SAML 5
web
-
已移除
MvcRequestMatcher和AntPathRequestMatcher,改为使用PathPatternRequestMatcher -
通过Spring MVC控制器,在授权代理中支持异常传播
-
已为Spring MVC类型添加了授权对象支持
-
已向默认登录页面添加支持,根据
factor.type和factor.reason参数显示因素 -
将`LoginUrlAuthenticationEntryPoint`默认更改为了更倾向于相对重定向