Java Code Examples for org.springframework.boot.context.embedded.FilterRegistrationBean#setOrder()
The following examples show how to use
org.springframework.boot.context.embedded.FilterRegistrationBean#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: CorsSupportConfiguration.java From spring-backend-boilerplate with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnExpression("${in.clouthink.daas.sbb.support.cors.enabled:true}") @Autowired public FilterRegistrationBean filterRegistrationBean(CorsSupportProperties corsSupportProperties) { final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); final CorsConfiguration corsConfiguration = new CorsConfiguration(); corsConfiguration.setAllowCredentials(corsSupportProperties.isAllowCredentials()); corsConfiguration.addAllowedOrigin(corsSupportProperties.getAllowOrigin()); corsConfiguration.addAllowedHeader(corsSupportProperties.getAllowHeader()); corsConfiguration.addAllowedMethod(corsSupportProperties.getAllowMethod()); urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); CorsFilter corsFilter = new CorsFilter(urlBasedCorsConfigurationSource); FilterRegistrationBean registration = new FilterRegistrationBean(corsFilter); registration.addUrlPatterns("/*"); registration.setOrder(corsSupportProperties.getOrder()); return registration; }
Example 2
Source File: WebSecurityConfig.java From mojito with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnProperty(value = "l10n.security.oauth2.enabled", havingValue = "true") public FilterRegistrationBean oauth2ClientFilterRegistration(OAuth2ClientContextFilter filter) { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(filter); registration.setOrder(-100); return registration; }
Example 3
Source File: OpenApiWebMvcConfigurer.java From spring-backend-boilerplate with Apache License 2.0 | 5 votes |
@Bean public FilterRegistrationBean httpMethodFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(httpMethodFilter()); registration.addUrlPatterns("/*"); registration.setName("httpMethodFilter"); registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1); return registration; }
Example 4
Source File: OpenApiWebMvcConfigurer.java From spring-backend-boilerplate with Apache License 2.0 | 5 votes |
@Bean public FilterRegistrationBean httpMethodFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(httpMethodFilter()); registration.addUrlPatterns("/*"); registration.setName("httpMethodFilter"); registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1); return registration; }
Example 5
Source File: RequestCorrelationConfiguration.java From request-correlation-spring-cloud-starter with Apache License 2.0 | 5 votes |
@Bean public FilterRegistrationBean requestCorrelationFilterBean(RequestCorrelationFilter correlationFilter) { final FilterRegistrationBean filterRegistration = new FilterRegistrationBean(); filterRegistration.setFilter(correlationFilter); filterRegistration.setMatchAfter(false); filterRegistration.setDispatcherTypes( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC)); filterRegistration.setAsyncSupported(true); filterRegistration.setOrder(Ordered.HIGHEST_PRECEDENCE); return filterRegistration; }
Example 6
Source File: WebConfig.java From jcart with MIT License | 5 votes |
@Bean public FilterRegistrationBean securityFilterChain(@Qualifier(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME) Filter securityFilter) { FilterRegistrationBean registration = new FilterRegistrationBean(securityFilter); registration.setOrder(Integer.MAX_VALUE - 1); registration.setName(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME); return registration; }
Example 7
Source File: WebConfig.java From jcart with MIT License | 5 votes |
@Bean public FilterRegistrationBean PostAuthorizationFilterRegistrationBean() { FilterRegistrationBean registrationBean = new FilterRegistrationBean(); registrationBean.setFilter(postAuthorizationFilter); registrationBean.setOrder(Integer.MAX_VALUE); return registrationBean; }