use of org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer in project spring-boot by spring-projects.
the class DefaultUserInfoRestTemplateFactory method getUserInfoRestTemplate.
@Override
public OAuth2RestTemplate getUserInfoRestTemplate() {
if (this.oauth2RestTemplate == null) {
this.oauth2RestTemplate = createOAuth2RestTemplate(this.details == null ? DEFAULT_RESOURCE_DETAILS : this.details);
this.oauth2RestTemplate.getInterceptors().add(new AcceptJsonRequestInterceptor());
AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();
accessTokenProvider.setTokenRequestEnhancer(new AcceptJsonRequestEnhancer());
this.oauth2RestTemplate.setAccessTokenProvider(accessTokenProvider);
if (!CollectionUtils.isEmpty(this.customizers)) {
AnnotationAwareOrderComparator.sort(this.customizers);
for (UserInfoRestTemplateCustomizer customizer : this.customizers) {
customizer.customize(this.oauth2RestTemplate);
}
}
}
return this.oauth2RestTemplate;
}
use of org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer in project spring-cloud-sleuth by spring-cloud.
the class TraceUserInfoRestTemplateCustomizer method customize.
@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);
}
}
Aggregations