org.apache.shiro.web.filter.mgt.DefaultFilter Java Examples
The following examples show how to use
org.apache.shiro.web.filter.mgt.DefaultFilter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CentralizeInitializer.java From java-platform with Apache License 2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { Map<String, String> filterChainDefinitionMap = Application.getSecurityFilterChainDefinitionMap(); filterChainDefinitionMap.put("/admin", DefaultFilter.authc.name()); filterChainDefinitionMap.put("/admin/logout", DefaultFilter.logout.name()); filterChainDefinitionMap.put("/admin/**", DefaultFilter.authc.name()); List<Filter> filters = Application.getFilters(); DelegatingFilterProxy shiroFilter = new DelegatingFilterProxy("shiroFilter"); shiroFilter.setTargetFilterLifecycle(true); filters.add(shiroFilter); filters.add(new RequestContextFilter()); filters.add(new CharacterEncodingFilter("UTF-8", true)); }
Example #2
Source File: ApplicationConfiguration.java From java-platform with Apache License 2.0 | 6 votes |
@Bean(name = "shiroFilter") public ShiroFilterFactoryBean shiroFilter() { ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); shiroFilterFactoryBean.setSecurityManager(securityManager); shiroFilterFactoryBean.setLoginUrl("/admin"); shiroFilterFactoryBean.setSuccessUrl("/admin"); shiroFilterFactoryBean.setUnauthorizedUrl("/error"); Map<String, Filter> filters = Application.getSecurityfilters(); AjaxAuthenticationFilter ajaxAuthenticationFilter = new AjaxAuthenticationFilter(); ajaxAuthenticationFilter.setRobotPrevention(new CaptchaRobotPrevention()); filters.put(DefaultFilter.authc.name(), ajaxAuthenticationFilter); shiroFilterFactoryBean.setFilters(filters); shiroFilterFactoryBean.setFilterChainDefinitionMap(Application.getSecurityFilterChainDefinitionMap()); return shiroFilterFactoryBean; }