<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="successUrl" value="/index.jsp" />
<property name="unauthorizedUrl" value="/500.htm" />
<property name="filters">
<util:map>
<entry key="authm">
<bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter" >
<property name="loginUrl" value="/user/login" />
</bean>
</entry>
</util:map>
</property>
<property name="filterChainDefinitions">
<value>
/user/login = anon <!--匿名-->
/user/** = authm <!--登录后可操作的路径-->
/admin/** = authm,roles[administrator] <!--管理员角色可操作的路径-->
</value>
</property>
</bean>
源码中其他过滤器:
1.AnonymousFilter 匿名过滤器
2.AuthenticatingFilter 认证过滤器
3.AuthenticationFilter 授权过滤器
4.BasicHttpAuthenticationFilter 基于http请求的过滤器
5.FormAuthenticationFilter
6.PassThruAuthenticationFilter
7.UserFilter
<property name="securityManager" ref="securityManager" />
<property name="successUrl" value="/index.jsp" />
<property name="unauthorizedUrl" value="/500.htm" />
<property name="filters">
<util:map>
<entry key="authm">
<bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter" >
<property name="loginUrl" value="/user/login" />
</bean>
</entry>
</util:map>
</property>
<property name="filterChainDefinitions">
<value>
/user/login = anon <!--匿名-->
/user/** = authm <!--登录后可操作的路径-->
/admin/** = authm,roles[administrator] <!--管理员角色可操作的路径-->
</value>
</property>
</bean>
源码中其他过滤器:
1.AnonymousFilter 匿名过滤器
2.AuthenticatingFilter 认证过滤器
3.AuthenticationFilter 授权过滤器
4.BasicHttpAuthenticationFilter 基于http请求的过滤器
5.FormAuthenticationFilter
6.PassThruAuthenticationFilter
7.UserFilter