Search in sources :

Example 1 with CsrfFilter

use of com.erudika.scoold.utils.CsrfFilter 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)

Aggregations

CsrfFilter (com.erudika.scoold.utils.CsrfFilter)1 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)1 Bean (org.springframework.context.annotation.Bean)1