use of org.springframework.boot.web.servlet.FilterRegistrationBean in project cas by apereo.
the class CasLoggingConfiguration method threadContextMDCServletFilter.
@Bean
public FilterRegistrationBean threadContextMDCServletFilter() {
final Map<String, String> initParams = new HashMap<>();
final FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ThreadContextMDCServletFilter(ticketRegistrySupport, this.ticketGrantingTicketCookieGenerator));
bean.setUrlPatterns(Collections.singleton("/*"));
bean.setInitParameters(initParams);
bean.setName("threadContextMDCServletFilter");
bean.setOrder(0);
return bean;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project spring-boot by spring-projects.
the class SampleJersey1Application method jersey.
@Bean
public FilterRegistrationBean<ServletContainer> jersey() {
FilterRegistrationBean<ServletContainer> bean = new FilterRegistrationBean<>();
bean.setFilter(new ServletContainer());
bean.addInitParameter("com.sun.jersey.config.property.packages", "com.sun.jersey;sample.jersey1");
return bean;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project cas by apereo.
the class CasFiltersConfiguration method requestParameterSecurityFilter.
@RefreshScope
@Bean
public FilterRegistrationBean requestParameterSecurityFilter() {
final Map<String, String> initParams = new HashMap<>();
initParams.put(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK, casProperties.getHttpWebRequest().getParamsToCheck());
initParams.put(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID, "none");
initParams.put(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS, BooleanUtils.toStringTrueFalse(casProperties.getHttpWebRequest().isAllowMultiValueParameters()));
initParams.put(RequestParameterPolicyEnforcementFilter.ONLY_POST_PARAMETERS, casProperties.getHttpWebRequest().getOnlyPostParams());
final FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new RequestParameterPolicyEnforcementFilter());
bean.setUrlPatterns(Collections.singleton("/*"));
bean.setName("requestParameterSecurityFilter");
bean.setInitParameters(initParams);
bean.setAsyncSupported(true);
return bean;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project cas by apereo.
the class CasFiltersConfiguration method responseHeadersSecurityFilter.
@RefreshScope
@Bean
public FilterRegistrationBean responseHeadersSecurityFilter() {
final HttpWebRequestProperties.Header header = casProperties.getHttpWebRequest().getHeader();
final Map<String, String> initParams = new HashMap<>();
initParams.put("enableCacheControl", BooleanUtils.toStringTrueFalse(header.isCache()));
initParams.put("enableXContentTypeOptions", BooleanUtils.toStringTrueFalse(header.isXcontent()));
initParams.put("enableStrictTransportSecurity", BooleanUtils.toStringTrueFalse(header.isHsts()));
initParams.put("enableXFrameOptions", BooleanUtils.toStringTrueFalse(header.isXframe()));
initParams.put("enableXSSProtection", BooleanUtils.toStringTrueFalse(header.isXss()));
final FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ResponseHeadersEnforcementFilter());
bean.setUrlPatterns(Collections.singleton("/*"));
bean.setInitParameters(initParams);
bean.setName("responseHeadersSecurityFilter");
bean.setAsyncSupported(true);
return bean;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project cas by apereo.
the class CasFiltersConfiguration method characterEncodingFilter.
@RefreshScope
@Bean
public FilterRegistrationBean characterEncodingFilter() {
final FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new CharacterEncodingFilter(casProperties.getHttpWebRequest().getWeb().getEncoding(), casProperties.getHttpWebRequest().getWeb().isForceEncoding()));
bean.setUrlPatterns(Collections.singleton("/*"));
bean.setName("characterEncodingFilter");
bean.setAsyncSupported(true);
return bean;
}
Aggregations