@Bean public UserInfoRestTemplateCustomizer getUserInfoRestTemplateCustomizer() { return new UserInfoRestTemplateCustomizer() { @Override public void customize(OAuth2RestTemplate template) { template.setAccessTokenProvider(new MyAuthorizationCodeAccessTokenProvider()); } }; }
@Bean public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer( TraceRestTemplateInterceptor traceRestTemplateInterceptor) { return restTemplate -> { List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>( restTemplate.getInterceptors()); interceptors.add(traceRestTemplateInterceptor); restTemplate.setInterceptors(interceptors); }; }
@Bean public UserInfoRestTemplateCustomizer loadBalancedUserInfoRestTemplateCustomizer( final LoadBalancerInterceptor loadBalancerInterceptor) { return new UserInfoRestTemplateCustomizer() { @Override public void customize(OAuth2RestTemplate restTemplate) { List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>( restTemplate.getInterceptors()); interceptors.add(loadBalancerInterceptor); restTemplate.setInterceptors(interceptors); } }; }
@Bean public UserInfoRestTemplateCustomizer retryLoadBalancedUserInfoRestTemplateCustomizer( final RetryLoadBalancerInterceptor loadBalancerInterceptor) { return new UserInfoRestTemplateCustomizer() { @Override public void customize(OAuth2RestTemplate restTemplate) { List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>( restTemplate.getInterceptors()); interceptors.add(loadBalancerInterceptor); restTemplate.setInterceptors(interceptors); } }; }