本文整理了Java中org.springframework.security.oauth2.client.OAuth2RestTemplate.getInterceptors()
方法的一些代码示例,展示了OAuth2RestTemplate.getInterceptors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OAuth2RestTemplate.getInterceptors()
方法的具体详情如下:
包路径:org.springframework.security.oauth2.client.OAuth2RestTemplate
类名称:OAuth2RestTemplate
方法名:getInterceptors
暂无
代码示例来源:origin: spring-cloud/spring-cloud-security
@Override
public void customize(OAuth2RestTemplate restTemplate) {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(loadBalancerInterceptor);
restTemplate.setInterceptors(interceptors);
}
};
代码示例来源:origin: junneyang/xxproject
@Bean
public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
return restTemplate -> {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(traceRestTemplateInterceptor);
restTemplate.setInterceptors(interceptors);
};
}
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-security
@Override
public void customize(OAuth2RestTemplate restTemplate) {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(loadBalancerInterceptor);
restTemplate.setInterceptors(interceptors);
}
};
代码示例来源:origin: spring-cloud/spring-cloud-security
@Override
public void customize(OAuth2RestTemplate restTemplate) {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(loadBalancerInterceptor);
restTemplate.setInterceptors(interceptors);
}
};
代码示例来源:origin: junneyang/xxproject
@Bean
public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
return restTemplate -> {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(traceRestTemplateInterceptor);
restTemplate.setInterceptors(interceptors);
};
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-security
@Override
public void customize(OAuth2RestTemplate restTemplate) {
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
restTemplate.getInterceptors());
interceptors.add(loadBalancerInterceptor);
restTemplate.setInterceptors(interceptors);
}
};
代码示例来源:origin: spring-projects/spring-security-oauth2-boot
@Override
public void customize(OAuth2RestTemplate template) {
template.getInterceptors()
.add((request, body, execution) -> execution.execute(request, body));
}
代码示例来源:origin: spring-projects/spring-security-oauth2-boot
@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;
}
代码示例来源:origin: org.springframework.security.oauth.boot/spring-security-oauth2-autoconfigure
@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;
}
内容来源于网络,如有侵权,请联系作者删除!