博客已移至 http://blog.gogl.top
前段时间比较懒,项目也有些紧,没有写什么东西。现在再对Shiro做一些整理。上一篇主要介绍了一个完整而又简单的shiro集成到项目的例子,主要是spring项目。这篇文章,想谈一下关于shiro的filter,这需要读者对shiro有一定的理解,至少有用过shiro。
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="/login" />
<property name="successUrl" value="/home" />
<property name="unauthorizedUrl" value="/unauthorized" />
<!-- The 'filters' property is usually not necessary unless performing
an override, which we want to do here (make authc point to a PassthruAuthenticationFilter
instead of the default FormAuthenticationFilter: -->
<!-- <property name="filters">
<map>
<entry key="authc">
<bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter" />
</entr

本文探讨了Apache Shiro框架中的过滤器机制,重点讲解了如何配置和使用filterChainDefinitions,包括未登录重定向、登录成功跳转以及权限不足的处理。通过自定义filter别名,可以实现对特定请求的特殊处理,例如创建一个名为new的filter来处理/new请求。
最低0.47元/天 解锁文章





