Java 类org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateFactory 实例源码

项目:spring-cloud-security    文件:OAuth2LoadBalancerClientAutoConfigurationTests.java   
@Test
public void userInfoLoadBalancedNoRetry() throws Exception {
    this.context = new SpringApplicationBuilder(ClientConfiguration.class)
            .properties("spring.config.name=test", "server.port=0",
                    "security.oauth2.resource.userInfoUri:http://nosuchservice",
                    "security.oauth2.resource.loadBalanced=true")
            .run();

    assertTrue(this.context.containsBean("loadBalancedUserInfoRestTemplateCustomizer"));
    assertFalse(this.context.containsBean("retryLoadBalancedUserInfoRestTemplateCustomizer"));

    OAuth2RestTemplate template = this.context
            .getBean(UserInfoRestTemplateFactory.class).getUserInfoRestTemplate();
    ClientHttpRequest request = template.getRequestFactory()
            .createRequest(new URI("http://nosuchservice"), HttpMethod.GET);
    expected.expectMessage("No instances available for nosuchservice");
    request.execute();
}
项目:spring-security-oauth2-boot    文件:SsoSecurityConfigurer.java   
private OAuth2ClientAuthenticationProcessingFilter oauth2SsoFilter(
        OAuth2SsoProperties sso) {
    OAuth2RestOperations restTemplate = this.applicationContext
            .getBean(UserInfoRestTemplateFactory.class).getUserInfoRestTemplate();
    ResourceServerTokenServices tokenServices = this.applicationContext
            .getBean(ResourceServerTokenServices.class);
    OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
            sso.getLoginPath());
    filter.setRestTemplate(restTemplate);
    filter.setTokenServices(tokenServices);
    filter.setApplicationEventPublisher(this.applicationContext);
    return filter;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SsoSecurityConfigurer.java   
private OAuth2ClientAuthenticationProcessingFilter oauth2SsoFilter(
        OAuth2SsoProperties sso) {
    OAuth2RestOperations restTemplate = this.applicationContext
            .getBean(UserInfoRestTemplateFactory.class).getUserInfoRestTemplate();
    ResourceServerTokenServices tokenServices = this.applicationContext
            .getBean(ResourceServerTokenServices.class);
    OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
            sso.getLoginPath());
    filter.setRestTemplate(restTemplate);
    filter.setTokenServices(tokenServices);
    filter.setApplicationEventPublisher(this.applicationContext);
    return filter;
}
项目:spring-boot-concourse    文件:SsoSecurityConfigurer.java   
private OAuth2ClientAuthenticationProcessingFilter oauth2SsoFilter(
        OAuth2SsoProperties sso) {
    OAuth2RestOperations restTemplate = this.applicationContext
            .getBean(UserInfoRestTemplateFactory.class).getUserInfoRestTemplate();
    ResourceServerTokenServices tokenServices = this.applicationContext
            .getBean(ResourceServerTokenServices.class);
    OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
            sso.getLoginPath());
    filter.setRestTemplate(restTemplate);
    filter.setTokenServices(tokenServices);
    filter.setApplicationEventPublisher(this.applicationContext);
    return filter;
}
项目:building-microservices    文件:EdgeServiceApplication.java   
@Bean
OAuth2RestTemplate restTemplate(UserInfoRestTemplateFactory templateFactory) {
    return templateFactory.getUserInfoRestTemplate();
}