本文整理匯總了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;
}