目标:这种配置是写死的,而我们需要做活
1、使用 perms 如:
/admins/user/**=perms[user:add:*]表示:要访问【/admins/user/**】必须具有【user:add:* 】权限
perms支持使用逗号隔开,不过需要两个权限都有才可以
2、原配置类为 ShiroFilterFactoryBean
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
3、重写 ShiroFilterFactoryBean 的 setFilterChainDefinitions 方法 ,同时将上面的shiroFilter中的class修改为新建的类
package com.sub.shiro;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.shiro.config.Ini;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.util.CollectionUtils;
import org.apache.shiro.