Reputation: 3750
i just getting started to learning Spring Security with OAuth2 and i want to create Authorization Server and Resource Server for my microservice Restful Api. But i am confuse which dependency to start with, since i found some of them. i use spring boot 2.4.1 version. here i list it below :
This one i found it at spring initializer page, when i try to add OAuth2 library, is this one the latest version?
<!-- 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>
below this one i found it at some tutorial, which is i think this one is already deprecated right?
<!-- 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>
And last one, is this one below, since i don't see there is an updated version anymore, is this one deprecated too?
<!-- 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>
which one should i use?
Upvotes: 4
Views: 6025
Reputation: 19
As @dislexit commented the authorization server was removed from spring security and there is another project that will support it, coming to the answer Spring Security 5+ will support the resource and client features of oauth2 so you can use it instead of both you mentioned.
follow this link to see the differences https://github.com/spring-projects/spring-security/wiki/OAuth-2.0-Features-Matrix
Upvotes: 0
Reputation: 773
Spring Boot 2.4.x uses Spring Security 5.4.x, which sadly removed its support for authorization servers.
There's a new project, spring-authorization-sever, aimed at bringing it back in the future, but currently it's only at version 0.0.3.
If you need it for your project, I'd recommend using spring boot 2.3.x instead.
Upvotes: 3