shiro学习20-shiro提供的filter-PathMatchingFilter类

本文探讨了Shiro框架中PathMatchingFilter类的功能和工作原理,它作为AdviceFilter的实现,处理预处理逻辑。重点在于appliedPaths属性及其在匹配访问路径中的作用。虽然PathMatchingFilter在某些场景下提供了便利,但其硬编码的权限配置可能限制了灵活性。文章建议在运行时动态配置权限的情况下避免使用此类,并介绍了其继承类如AccessControlFilter、AnonymousFilter和NoSessionCreationFilter的应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个类也是AdviceFilter的实现类,我们先看看他的preHandle方法

protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        if (this.appliedPaths == null || this.appliedPaths.isEmpty()) {
            if (log.isTraceEnabled()) {
                log.trace("appliedPaths property is null or empty.  This Filter will passthrough immediately.");
            }
            return true;
        }
        for (String path : this.appliedPaths.keySet()) {
            // If the path does match, then pass on to the subclass implementation for specific checks
            //(first match 'wins'):
            if (pathsMatch(path, request)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值