Java 类org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration 实例源码

项目:spring-security-oauth2-boot    文件:MultipleResourceServerConfigurationTests.java   
@Test
public void orderIsUnchangedWhenThereAreMultipleResourceServerConfigurations() {
    this.context = new AnnotationConfigWebApplicationContext();
    this.context.register(DoubleResourceConfiguration.class);
    TestPropertyValues.of("security.oauth2.resource.tokenInfoUri:http://example.com",
            "security.oauth2.client.clientId=acme").applyTo(this.context);
    this.context.refresh();
    assertThat(this.context
            .getBean("adminResources", ResourceServerConfiguration.class).getOrder())
                    .isEqualTo(3);
    assertThat(this.context
            .getBean("otherResources", ResourceServerConfiguration.class).getOrder())
                    .isEqualTo(4);
}
项目:spring-security-oauth2-boot    文件:MultipleResourceServerConfigurationTests.java   
@Bean
protected ResourceServerConfiguration adminResources() {

    ResourceServerConfiguration resource = new ResourceServerConfiguration() {
        // Switch off the Spring Boot @Autowired configurers
        @Override
        public void setConfigurers(List<ResourceServerConfigurer> configurers) {
            super.setConfigurers(configurers);
        }
    };
    resource.setOrder(3);
    return resource;
}
项目:spring-security-oauth2-boot    文件:MultipleResourceServerConfigurationTests.java   
@Bean
protected ResourceServerConfiguration otherResources() {

    ResourceServerConfiguration resource = new ResourceServerConfiguration() {
        // Switch off the Spring Boot @Autowired configurers
        @Override
        public void setConfigurers(List<ResourceServerConfigurer> configurers) {
            super.setConfigurers(configurers);
        }
    };
    resource.setOrder(4);
    return resource;
}
项目:spring-microservices-boilerplate    文件:CustomResourceServerConfiguration.java   
/**
 * Resource of api
 *
 * @return {@link ResourceServerConfiguration}
 */
@Bean protected ResourceServerConfiguration adminResources() {

  ResourceServerConfiguration resource = new ResourceServerConfiguration() {
    // Switch off the Spring Boot @Autowired configurers
    public void setConfigurers(List<ResourceServerConfigurer> configurers) {
      super.setConfigurers(configurers);
    }
  };

  resource.setConfigurers(Collections.singletonList(new ResourceServerConfigurerAdapter() {

    @Override public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
      resources.resourceId(RESOURCE_ID);
    }

    @Override public void configure(HttpSecurity http) throws Exception {
      http
          .csrf().disable()
          .authorizeRequests()
          .antMatchers(OPEN_URL).permitAll()
          .antMatchers(MANAGEMENT_URL).hasAnyAuthority("root", "management")
          .antMatchers(APP_URL).hasAnyAuthority("root", "management", "app");
    }
  }));

  resource.setOrder(1);

  return resource;
}
项目:contestparser    文件:OAuth2AutoConfiguration.java   
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
        throws BeansException {
    if (bean instanceof ResourceServerConfiguration) {
        ResourceServerConfiguration configuration = (ResourceServerConfiguration) bean;
        configuration.setOrder(getOrder());
    }
    return bean;
}
项目:jsonwebtoken    文件:OAuth2ResourceServerConfiguration.java   
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
        throws BeansException {
    if (bean instanceof ResourceServerConfiguration) {
        if (this.context.getBeanNamesForType(ResourceServerConfiguration.class,
                false, false).length == 1) {
            ResourceServerConfiguration config = (ResourceServerConfiguration) bean;
            config.setOrder(this.properties.getFilterOrder());
        }
    }
    return bean;
}