Search in sources :

Example 1 with NamedFilterList

use of org.apache.shiro.web.filter.mgt.NamedFilterList in project shiro by apache.

the class ShiroFilterFactoryBeanTest method testFilterDefinition.

@Test
public void testFilterDefinition() {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/shiro/spring/web/ShiroFilterFactoryBeanTest.xml");
    AbstractShiroFilter shiroFilter = (AbstractShiroFilter) context.getBean("shiroFilter");
    PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) shiroFilter.getFilterChainResolver();
    DefaultFilterChainManager fcManager = (DefaultFilterChainManager) resolver.getFilterChainManager();
    NamedFilterList chain = fcManager.getChain("/test");
    assertNotNull(chain);
    assertEquals(chain.size(), 2);
    Filter[] filters = new Filter[chain.size()];
    filters = chain.toArray(filters);
    assertTrue(filters[0] instanceof DummyFilter);
    assertTrue(filters[1] instanceof FormAuthenticationFilter);
}
Also used : DefaultFilterChainManager(org.apache.shiro.web.filter.mgt.DefaultFilterChainManager) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) FormAuthenticationFilter(org.apache.shiro.web.filter.authc.FormAuthenticationFilter) AbstractShiroFilter(org.apache.shiro.web.servlet.AbstractShiroFilter) FormAuthenticationFilter(org.apache.shiro.web.filter.authc.FormAuthenticationFilter) AbstractShiroFilter(org.apache.shiro.web.servlet.AbstractShiroFilter) NamedFilterList(org.apache.shiro.web.filter.mgt.NamedFilterList) PathMatchingFilterChainResolver(org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver) Test(org.junit.Test)

Aggregations

FormAuthenticationFilter (org.apache.shiro.web.filter.authc.FormAuthenticationFilter)1 DefaultFilterChainManager (org.apache.shiro.web.filter.mgt.DefaultFilterChainManager)1 NamedFilterList (org.apache.shiro.web.filter.mgt.NamedFilterList)1 PathMatchingFilterChainResolver (org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver)1 AbstractShiroFilter (org.apache.shiro.web.servlet.AbstractShiroFilter)1 Test (org.junit.Test)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1