Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OAuth2FeignRequestInterceptor class deprecated in Spring Boot 2.3

In our last feign client security configuration we have this Bean:

    @Bean
    public RequestInterceptor oauth2FeignRequestInterceptor(
            ClientCredentialsResourceDetails oauth2RemoteResource) {
        return new OAuth2FeignRequestInterceptor(
                new DefaultOAuth2ClientContext(),
                oauth2RemoteResource
        );
    }

In 2.3 spring version OAuth2FeignRequestInterceptor is deprecated! But we cannot found the new one.

Anyone knows something about that?

like image 433
ChetoCovers Avatar asked Jun 18 '20 10:06

ChetoCovers


People also ask

Is spring boot OAuth2 deprecated?

End of Life NoticeThe Spring Security OAuth project has reached end of life and is no longer actively maintained by VMware, Inc. This project has been replaced by the OAuth2 support provided by Spring Security and Spring Authorization Server.

What is OAuth2FeignRequestInterceptor?

public class OAuth2FeignRequestInterceptor extends Object implements feign.RequestInterceptor. Pre-defined custom RequestInterceptor for Feign Requests It uses the OAuth2ClientContext provided from the environment and construct a new header on the request before it is made by Feign.

What is Oauth 2.0 in spring boot?

OAuth2 is an authorization framework that enables the application Web Security to access the resources from the client. To build an OAuth2 application, we need to focus on the Grant Type (Authorization code), Client ID and Client secret.

Is oauth part of Spring Security?

For checking oauth tokens, Spring Security oauth exposes two endpoints – /oauth/check_token and /oauth/token_key. These endpoints are protected by default behind denyAll().


1 Answers

You can create your own RequestInterceptor to add the Authorization header.

There's an example here: https://developer.okta.com/blog/2018/02/13/secure-spring-microservices-with-oauth

like image 67
slodj Avatar answered Oct 25 '22 22:10

slodj