本文整理汇总了Java中org.springframework.boot.web.servlet.FilterRegistrationBean.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java FilterRegistrationBean.setEnabled方法的具体用法?Java FilterRegistrationBean.setEnabled怎么用?Java FilterRegistrationBean.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.web.servlet.FilterRegistrationBean
的用法示例。
在下文中一共展示了FilterRegistrationBean.setEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disableDefaultOAuth
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean disableDefaultOAuth(OAuth2AuthenticationProcessingFilter filter) {
FilterRegistrationBean registration = new FilterRegistrationBean(filter);
registration.setEnabled(false);
return registration;
}
示例2: singleSignOutFilter
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* 注册单点登出filter
* @return
*/
@Bean
public FilterRegistrationBean singleSignOutFilter(){
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setName("singleSignOutFilter");
bean.setFilter(new SingleSignOutFilter());
bean.addUrlPatterns("/*");
bean.setEnabled(true);
//bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
return bean;
}
示例3: delegatingFilterProxy
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* 注册DelegatingFilterProxy(Shiro)
*
* @return
* @author SHANHY
* @create 2016年1月13日
*/
@Bean
public FilterRegistrationBean delegatingFilterProxy() {
FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter"));
// 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理
filterRegistration.addInitParameter("targetFilterLifecycle", "true");
filterRegistration.setEnabled(true);
filterRegistration.addUrlPatterns("/*");
return filterRegistration;
}
示例4: filterRegistrationBean
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* 注册shiroFilter
*/
@Bean
public FilterRegistrationBean filterRegistrationBean(){
FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter"));
// 该值缺省为false,表示生命周期有SpringApplicationContext管理,设置为true则表示由ServletContainer管理
filterRegistration.addInitParameter("targetFilterLifecycle", "true");
filterRegistration.setEnabled(true);
filterRegistration.addUrlPatterns("/*");
return filterRegistration;
}
示例5: shiroFilterRegistration
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean shiroFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new DelegatingFilterProxy("shiroFilter"));
//该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理
registration.addInitParameter("targetFilterLifecycle", "true");
registration.setEnabled(true);
registration.setOrder(Integer.MAX_VALUE - 1);
registration.addUrlPatterns("/*");
return registration;
}
示例6: requestContextFilter
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean requestContextFilter() {
final FilterRegistrationBean filterRegBean = new FilterRegistrationBean();
filterRegBean.setFilter(new RequestContextFilter());
filterRegBean.addUrlPatterns("*");
filterRegBean.setEnabled(Boolean.TRUE);
filterRegBean.setName("RequestContextFilter");
return filterRegBean;
}
示例7: csrfFilterRegistrationBean
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* @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;
}
示例8: disableDefaultClientCredentials
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean disableDefaultClientCredentials(
ClientCredentialsTokenEndpointFilter filter) {
FilterRegistrationBean registration = new FilterRegistrationBean(filter);
registration.setEnabled(false);
return registration;
}
示例9: juiserForwardedUserFilter
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = "juiserForwardedUserFilter")
public FilterRegistrationBean juiserForwardedUserFilter() {
ForwardedUserFilterConfig cfg = juiserForwardedUserFilterConfig();
Filter filter = new SpringForwardedUserFilter(forwardedHeaderConfig().getName(),
juiserRequestUserFactory(),
cfg.getRequestAttributeNames());
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(filter);
bean.setEnabled(cfg.isEnabled());
bean.setMatchAfter(cfg.isMatchAfter());
bean.setOrder(cfg.getOrder());
Set<DispatcherType> dispatcherTypes = cfg.getDispatcherTypes();
if (!CollectionUtils.isEmpty(dispatcherTypes)) {
bean.setDispatcherTypes(EnumSet.copyOf(dispatcherTypes));
}
Set<String> set = cfg.getServletNames();
if (!CollectionUtils.isEmpty(set)) {
bean.setServletNames(set);
}
set = cfg.getUrlPatterns();
if (!CollectionUtils.isEmpty(set)) {
bean.setUrlPatterns(set);
}
return bean;
}
示例10: disableDefaultUsernameAuth
import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean disableDefaultUsernameAuth(UsernamePasswordAuthenticationFilter filter) {
FilterRegistrationBean registration = new FilterRegistrationBean(filter);
registration.setEnabled(false);
return registration;
}