SHARE
TWEET

Untitled

a guest Mar 25th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @Autowired
  2.     RibbonClientHttpRequestFactory requestFactory;
  3.     @Bean
  4.     RequestInterceptor oauth2FeignRequestInterceptor() {
  5.  
  6.         final OAuth2FeignRequestInterceptor oAuth2FeignRequestInterceptor = new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), resource());
  7.         final ClientCredentialsAccessTokenProvider clientCredentialsAccessTokenProvider = new ClientCredentialsAccessTokenProvider();
  8.         clientCredentialsAccessTokenProvider.setRequestFactory(requestFactory);
  9.         oAuth2FeignRequestInterceptor.setAccessTokenProvider(clientCredentialsAccessTokenProvider);
  10.         return oAuth2FeignRequestInterceptor;
  11.     }
  12.  
  13.     private OAuth2ProtectedResourceDetails resource() {
  14.         ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
  15.         details.setAccessTokenUri(accessTokenUri);
  16.         details.setClientId(clientId);
  17.         details.setClientSecret(clientSecret);
  18.         details.setScope(scope);
  19.         return details;
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top