Java Code Examples for org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration#setOrder()

The following examples show how to use org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration#setOrder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleResourceServerConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 2
Source File: MultipleResourceServerConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 3
Source File: CustomResourceServerConfiguration.java    From spring-microservice-boilerplate with MIT License 5 votes vote down vote up
/**
 * 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;
}