org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.java    From xxproject with Apache License 2.0 5 votes vote down vote up
@Bean
public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
        TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
    return restTemplate -> {
        List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
                restTemplate.getInterceptors());
        interceptors.add(traceRestTemplateInterceptor);
        restTemplate.setInterceptors(interceptors);
    };
}
 
Example #2
Source File: Application.java    From xxproject with Apache License 2.0 5 votes vote down vote up
@Bean
public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
        TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
    return restTemplate -> {
        List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
                restTemplate.getInterceptors());
        interceptors.add(traceRestTemplateInterceptor);
        restTemplate.setInterceptors(interceptors);
    };
}
 
Example #3
Source File: TraceWebClientAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(final Object bean,
		String beanName) throws BeansException {
	final BeanFactory beanFactory = this.beanFactory;
	if (bean instanceof UserInfoRestTemplateCustomizer
			&& !(bean instanceof TraceUserInfoRestTemplateCustomizer)) {
		return new TraceUserInfoRestTemplateCustomizer(beanFactory, bean);
	}
	return bean;
}
 
Example #4
Source File: TraceWebClientAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Override
public void customize(OAuth2RestTemplate template) {
	final TracingClientHttpRequestInterceptor interceptor = this.beanFactory
			.getBean(TracingClientHttpRequestInterceptor.class);
	new RestTemplateInterceptorInjector(interceptor).inject(template);
	if (this.delegate != null) {
		((UserInfoRestTemplateCustomizer) this.delegate).customize(template);
	}
}
 
Example #5
Source File: OAuth2LoadBalancerClientAutoConfiguration.java    From spring-cloud-security with Apache License 2.0 5 votes vote down vote up
@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);
		}
	};
}
 
Example #6
Source File: OAuth2LoadBalancerClientAutoConfiguration.java    From spring-cloud-security with Apache License 2.0 5 votes vote down vote up
@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);
		}
	};
}
 
Example #7
Source File: TraceWebClientAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
static UserInfoRestTemplateCustomizer traceUserInfoRestTemplateCustomizer(
		BeanFactory beanFactory) {
	return new TraceUserInfoRestTemplateCustomizer(beanFactory);
}