spring-boot-starter-oauth2-resource-server与spring-cloud-starter-oauth2使用哪一个?

lf5gs5x2  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(962)

我刚刚开始学习使用oauth2的Spring Security ,我想为我的microservicerestfulapi创建授权服务器和资源服务器。但我不知道从哪个依赖开始,因为我发现了其中的一些。我使用springboot2.4.1版本。在这里我列出如下:
我在spring初始化器页面上找到了这个,当我尝试添加oauth2库时,这个是最新版本吗?

<!-- 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>

我应该用哪一个?

u0sqgete

u0sqgete1#

springboot2.4.x使用了springsecurity5.4.x,不幸的是它取消了对授权服务器的支持。
有一个新的项目,springauthorizationsever,目的是在将来把它带回来,但目前它只有版本0.0.3。
如果您的项目需要它,我建议改用SpringBoot2.3.x。

相关问题