当前位置: 首页 > 后端技术 > Java

SpringSecurityOAuth已正式终止维护,已从官网下架

时间:2023-04-01 13:41:02 Java

SpringSecurity团队正式宣布SpringSecurityOAuth已终止维护。目前官网首页已高亮提示维护完全停止。旧的SpringSecurityOAuth项目终止到版本2.5.2.RELEASE。该项目不会进行任何迭代,包括错误修复。胖哥已经提醒项目停止维护,感兴趣的同学已经迁移了。项目文档和代码仓库已被移除。该项目的官方文档已经从spring.io正式下架,文档已经指向404,也就是没有文档。添加了OAuth2授权服务器Spring授权服务器的文档。不仅文档被移除,就连项目仓库也被迁移到Spring过时的项目仓库spring-attic并标记为只读。SpringSecurityOAuth的SpringBoot自动配置代码仓库也被迁移,也就是说SpringBoot相关的自动配置也被移除。从这种情况看来,SpringSecurityOAuth确实已经死了。不可用吗?当然不是。迁移指南这是胖哥总结的迁移指南。依赖性检查那么你如何检查你的项目是否使用旧的OAuth2工具?当然,会检查依赖项。以下清单中的依赖任何版本的都是过期的,都需要迁移:org.springframework.security.oauthspring-security-oauth-parentorg.springframework.security.oauthspring-security-oauthorg.springframework.security.oauthspring-security-oauth2org.springframework.securityspring-security-jwt<依赖>org.springframework.security.oauth.bootspring-security-oauth2-autoconfigure可以通过mvndependency:tree查看依赖树是否集成了以上依赖新的OAuth2替代方案需要开发者掌握一些知识OAuth2.0、OAuth2.1、OIDC1.0。SpringSecurity5中集成了OAuth2Client和ResourceServer两个模块,如果有迁移需求,建议迁移到最新的SpringSecurity5.7.x,方便过渡到Spring6。以SpringBoot作为例如,首先要集成SpringSecurity:org.springframework.bootspring-boot-starter-security建议使用最新版本这里,目前是2.7。集成OAuth2Client依赖OAuth2Client依赖SpringSecurity,不能单独使用:org.springframework.bootspring-boot-starter-oauth2-clientIntegratedResourceServer依赖于ResourceServer也依赖于SpringSecurity,不能单独使用:org.springframework.bootspring-boot-starter-oauth2-resource-server集成的OAuth2授权服务器依赖,目前Spring生态中的OAuth2授权服务器为SpringAuthorizationServer,目前已准备生产。在最新的0.3.0版本中,官方文档正式上线spring.io。您需要知道的是,它必须在Java11及更高版本中使用。也是SpringSecurity的一个子模块,不能单独使用:org.springframework.securityspring-security-oauth2-authorization-server0.3.0告诉大家,这个项目的SpringBootStarter也即将实现。在学习指南中,胖哥系统地总结了近几个月新的OAuth2相关资料。所以,只要关注胖哥,就可以随时获取相关知识和实用干货分享。当然,这里的胖哥也给了一些参考文档:OAuth2框架:https://oauth.netOIDC1.0协议:https://openid.netSpringSecurity:http://felord.cnNewSpringSecurityOAuth2:http:///felord.cn项目参考代码DEMO:SpringSecurity5学习:https://gitee.com/felord/secu...SpringSecurityOAuth2教程:https://github.com/NotFound40...AuthorizationserverconsoleIdServer:https://github.com/NotFound40...登录扩展:https://github.com/NotFound40...总结一下,老的SpringSecurityOAuth已经过期了,不用慌,除非你在这方面的架构需要不断迭代。但是随着新方案的出来,旧方案的可维护性会大大降低,如果条件允许还是需要迁移。SpringCloud也会在未来的某个时候做一些调整来适应新的架构。请继续关注,相关消息会及时带来。关注公众号:Felordcn获取更多资讯个人博客:https://felord.cn