Search in sources :

Example 6 with FilterRegistrationBean

use of org.springframework.boot.web.servlet.FilterRegistrationBean in project cas by apereo.

the class CasManagementAuditConfiguration method casClientInfoLoggingFilter.

@Bean
public FilterRegistrationBean casClientInfoLoggingFilter() {
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new ClientInfoThreadLocalFilter());
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setName("CAS Client Info Logging Filter");
    bean.setAsyncSupported(true);
    return bean;
}
Also used : ClientInfoThreadLocalFilter(org.apereo.inspektr.common.web.ClientInfoThreadLocalFilter) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 7 with FilterRegistrationBean

use of org.springframework.boot.web.servlet.FilterRegistrationBean in project scoold by Erudika.

the class ScooldServer method csrfFilterRegistrationBean.

/**
	 * @return CSRF protection filter bean
	 */
@Bean
public FilterRegistrationBean csrfFilterRegistrationBean() {
    String path = "/*";
    logger.debug("Initializing CSRF filter [{}]...", path);
    FilterRegistrationBean frb = new FilterRegistrationBean(new CsrfFilter());
    frb.setDispatcherTypes(EnumSet.of(DispatcherType.REQUEST));
    frb.setName("csrfFilter");
    frb.setAsyncSupported(true);
    frb.addUrlPatterns(path);
    frb.setMatchAfter(false);
    frb.setEnabled(true);
    frb.setOrder(2);
    return frb;
}
Also used : CsrfFilter(com.erudika.scoold.utils.CsrfFilter) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 8 with FilterRegistrationBean

use of org.springframework.boot.web.servlet.FilterRegistrationBean in project libresonic by Libresonic.

the class Application method parameterDecodingFilterRegistration.

@Bean
public FilterRegistrationBean parameterDecodingFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(parameterDecodingFilter());
    registration.addUrlPatterns("/*");
    registration.setName("ParameterDecodingFilter");
    registration.setOrder(2);
    return registration;
}
Also used : FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 9 with FilterRegistrationBean

use of org.springframework.boot.web.servlet.FilterRegistrationBean in project libresonic by Libresonic.

the class Application method noCacheFilterRegistration.

@Bean
public FilterRegistrationBean noCacheFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(noCacheFilter());
    registration.addUrlPatterns("/statusChart.view", "/userChart.view", "/playQueue.view", "/podcastChannels.view", "/podcastChannel.view", "/help.view", "/top.view", "/home.view");
    registration.addInitParameter("Cache-Control", "no-cache, post-check=0, pre-check=0");
    registration.addInitParameter("Pragma", "no-cache");
    registration.addInitParameter("Expires", "Thu, 01 Dec 1994 16:00:00 GMT");
    registration.setName("NoCacheFilter");
    registration.setOrder(6);
    return registration;
}
Also used : FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 10 with FilterRegistrationBean

use of org.springframework.boot.web.servlet.FilterRegistrationBean in project libresonic by Libresonic.

the class Application method requestEncodingFilterRegistration.

@Bean
public FilterRegistrationBean requestEncodingFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(requestEncodingFilter());
    registration.addUrlPatterns("/*");
    registration.addInitParameter("encoding", "UTF-8");
    registration.setName("RequestEncodingFilter");
    registration.setOrder(4);
    return registration;
}
Also used : FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)23 Bean (org.springframework.context.annotation.Bean)21 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)10 HashMap (java.util.HashMap)4 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)4 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)3 Filter (javax.servlet.Filter)2 HttpWebRequestProperties (org.apereo.cas.configuration.model.core.web.security.HttpWebRequestProperties)2 ClientInfoThreadLocalFilter (org.apereo.inspektr.common.web.ClientInfoThreadLocalFilter)2 Test (org.junit.Test)2 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)2 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)2 RegistrationBean (org.springframework.boot.web.servlet.RegistrationBean)2 WebStatFilter (com.alibaba.druid.support.http.WebStatFilter)1 CsrfFilter (com.erudika.scoold.utils.CsrfFilter)1 ServletContainer (com.sun.jersey.spi.container.servlet.ServletContainer)1 DispatcherType (javax.servlet.DispatcherType)1 ServletContext (javax.servlet.ServletContext)1 AuditProperties (org.apereo.cas.configuration.model.core.audit.AuditProperties)1 ThreadContextMDCServletFilter (org.apereo.cas.logging.web.ThreadContextMDCServletFilter)1