有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java springbootstarteroauth2resourceserver与springcloudstarteroauth2使用哪一种?

我刚刚开始学习使用OAuth2的Spring安全性,我想为我的microservice Restful Api创建授权服务器和资源服务器。但我不知道从哪个依赖项开始,因为我发现了其中的一些依赖项。我使用SpringBoot2.4.1版本。我在这里列出如下:

当我尝试添加OAuth2库时,我在spring初始化器页面上找到了它,这是最新版本吗

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-oauth2-resource-server -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>

在这本书下面,我在一些教程中找到了它,我认为这本书已经被弃用了,对吗

<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-oauth2 -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-oauth2</artifactId>
    <version>2.2.4.RELEASE</version>
</dependency>

最后一个,这是下面的一个,因为我看不到有更新的版本了,这也是不推荐的吗

<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
<dependency>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth2</artifactId>
    <version>2.5.0.RELEASE</version>
</dependency>

我应该用哪一个


共 (2) 个答案

  1. # 1 楼答案

    弹簧靴2.4。春季安全5.4。x、 不幸的是,它取消了对授权服务器的支持

    有一个新的项目spring-authorization-sever,旨在将来把它带回来,但目前它只有0.0.3版

    如果你的项目需要它,我建议使用spring boot 2.3。而是x