shiro 拦截了所有请求 感觉shiroFilter配置无效
Spring-shiro.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- rememberme配置 -->
<bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
<constructor-arg value="rememberMe"></constructor-arg>
<property name="httpOnly" value="true"></property>
<!-- 记住7天 -->
<property name="maxAge" value="604800"></property>
</bean>
<!-- remember管理器 -->
<bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager">
<!-- 加密密钥 -->
<property name="cipherKey" value="#{T(org.apache.shiro.codec.Base64).decode('4AvVhmFLUs0KTA3Kprsdag==')}"></property>
<property name="cookie" ref="rememberMeCookie"></property>
</bean>
<!-- web.xml中shiro的filter对应的bean -->
<!-- 配置securityManager-->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="gyrealm"></property>
<property name="rememberMeManager" ref="rememberMeManager"></property>
</bean>
<!-- 自定义realm-->
<bean id="gyrealm" class="cn.gy.wfs.realm.GYRealm"></bean>
<!-- 记住我功能设置session的Filter -->
<bean id="rememberMeFilter" class="cn.gy.wfs.realm.RememberMeFilter">
<property name="rememberMeParam" value="rememberme"></property>
</bean>
<!-- shiro的web过滤器 -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager"></property>
<!-- 要求登录时的链接(登录页面地址),非必须的属性,默认会自动寻找Web工程根目录下的"/login.jsp"页面 -->
<!--<property name="loginUrl" value="/admin/show"></property>-->
<!-- 身份认证失败跳转页面 -->
<property name="loginUrl" value="/login.jsp"></property>
<!-- 权限认证失败跳转页面 -->
<property name="unauthorizedUrl" value="/unauthor.jsp"></property>
<property name="filters">
<map>
<!-- rememberMe过滤器 -->
<entry key="rememberMe" value-ref="rememberMeFilter"></entry>
</map>
</property>
<property name="filterChainDefinitions">
<value>
<!-- /index.jsp = anon
/home.do = anon
/login.do = anon
/logout.do = logout
/agent/**=roles[agent]
/** = anon
/css/** = anon
/js/** = anon
/images/** = anon
/fonts/** = anon-->
/** = anon
</value>
</property>
</bean>
</beans>
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--shiro过滤器 -->
<filter>
<filter-name>shiroFilter</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>
<!--设置spring容器filter的bean id,如果不设置则找与filter-name一致的bean -->
<init-param>
<param-name>targetBeanName</param-name>
<param-value>shiroFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置核心控制器 -->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>