我的shiro之旅: 三 浅谈shiro的filter

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

博客已移至 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" />
				</entry>
			</map>
		</property> -->
		<property name="filterChainDefinitions">
			<value>
				/admin = authc,roles[admin]
				/e
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值