shiroFilter

Shiro源码分析之ShiroFilterFactoryBean

岁酱吖の 提交于 2020-03-02 18:12:42
一、Spring 的DelegatingFilterProxy如何发现 Shiro 的ShiroFilterFactoryBean 简单的回顾一下,web.xml配置中的Spring DelegatingFilterProxy 的这个Filter是如何找到WebApplicationcontext 配置(Spring.xml配置文件)中的ShiroFilterFactoryBean。 web.xml配置: <filter> <filter-name>securityFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> 其实际是通过上面web.xml文件中的<filter-name>securityFilter</filter-name>,securityFilter去找到spring-context.xml配置文件中类型为Filter,id为securityFilter的Bean。 spring

Spring与Shiro整合源码分析

拈花ヽ惹草 提交于 2020-03-02 16:38:45
Spring与Shiro整合是通过在web.xml里面配置过滤器: <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFileterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> 然后我们在apllicationContext.xml里面配置如下的ShiroFilterFactoryBean就可以了 <!-- Shiro 的Web过滤器 -->