Search in sources :

Example 1 with AcceptJsonRequestInterceptor

use of org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration.AcceptJsonRequestInterceptor 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;
}
Also used : AcceptJsonRequestEnhancer(org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration.AcceptJsonRequestEnhancer) AuthorizationCodeAccessTokenProvider(org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider) AcceptJsonRequestInterceptor(org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration.AcceptJsonRequestInterceptor)

Aggregations

AcceptJsonRequestEnhancer (org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration.AcceptJsonRequestEnhancer)1 AcceptJsonRequestInterceptor (org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration.AcceptJsonRequestInterceptor)1 AuthorizationCodeAccessTokenProvider (org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider)1