spring中的spring-security-oauth2和spring-security-oauth2-core有什么区别? spring-security-oauth2 是否被 spring-security-oauth2-core 取代?
spring-security-oauth2 发布链接: http://repo.spring.io/release/org/springframework/security/oauth/spring-security-oauth2/
spring-security-oauth2-core 发布链接 http://repo.spring.io/release/org/springframework/security/spring-security-oauth2-core/
是的,有很大的不同。 spring-security-oauth2(Spring Security OAuth 项目)不再积极开发。
展望未来,它将在 Spring Security 5 中实现(在 spring-security-oauth2-core 中)。这很令人困惑,因为许多教程都使用以前的 Spring Security OAuth(
@EnableResourceServer
、@EnableAuthorizationServer
和@EnableOAuth2Sso
注释通常会泄露它)。
第一个链接与 Spring 4 相关,它匹配 Spring Security 版本。您可以在 pom.xml 文件中验证这一点。
第二个链接与 Spring 5 和 Spring Security 5 相关。这不仅从您在该链接中看到的版本中直接看出,而且您可以在 Spring Security 5 文档中找到直接命名的依赖项。
Spring git 存储库中描述了差异
https://github.com/spring-projects/spring-security/wiki/OAuth-2.0-Migration-Guide
它是旧库:security/oauth/spring-security-oauth2/ 如您所见,该库位于 spring-security 的“oauth”组中。
我不建议使用旧库作为客户端,因为有许多未解决的问题,包括有关 clientContext 存储的问题(库使用代理而不是普通实体,因此当您将 MA 与分布式一起使用时,您会遇到问题缓存)。此外,它不允许同时使用多个 OAuth2.0 提供程序(仅限一个)。
同时,该库提供了一个显着的优势,可以使用新库中未实现的授权服务器。
spring-security-oauth2 和 spring-security-oauth2-core 是 Spring Security 生态系统中与基于 OAuth 2.0 的身份验证和授权相关的两个模块。尽管它们在功能方面有相似之处,但它们的目的和方法略有不同:
spring-security-oauth2:
spring-security-oauth2-core: