Recently we migrated from spring boot 2.x to 3.x when i tried hit a restapi through restclinet i am getting exception. After migrating we have springweb 6.x and oauth2 2.4 as our dependencies. I went through the code base of both dependencies I find out that In springweb 6.x ClientHttpResponse returning HttpStatusCode enter image description here

In Springweb 5.3.x ClientHttpResponse returning HttpStatus enter image description here

But in oauth2 handler it is expecting HttpStatus, but spring web 6 returning HttpStatusCode enter image description here

How can we fix this incompatible can some help with solution to get rid of this error.

5.3.x code : https://github.com/spring-projects/spring-framework/blob/5.3.x/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java 6.x code : https://github.com/spring-projects/spring-framework/blob/6.0.x/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java

Oauth2 code : https://github.com/spring-attic/spring-security-oauth/blob/main/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/http/OAuth2ErrorHandler.java

1

There are 1 answers

0
ch4mp On

spring-security-oauth is just not compatible with Spring Security 6 / Boot 3 and it won't be:

spring-security-oauth is no longer actively maintained by VMware, Inc.

This project has been replaced by the OAuth2 support provided by Spring Security (client and resource server) and Spring Authorization Server.

If you're looking for something simpler than spring-boot-starter-oauth2-client and spring-boot-starter-oauth2-resource-server, you can have a look at this starter I wrote.

If you're looking at something requiring less code than spring-authorization-server, then have a look at products like Keycloak or cloud offers like Auth0, Amazon Cognito, Okta, ...