Shiro权限配置和自定义过滤器冲突

时间:2019-04-28 14:29:53

标签: shiro

如果我将自定义过滤器jwt添加到shiroFilterFactoryBean,则urlFilter.put("/helloworld","authc,rolse[user]");为 无效。

Map<String,Filter> filterMap = new LinkedHashMap<>();
filterMap.put("jwt",new JWTFilter() );

shiroFilterFactoryBean.setFilters(filterMap);
Map<String,String> urlFilter = new LinkedHashMap<>();
urlFilter.put("/user/signin", "anon" );
urlFilter.put("/user/register", "anon" );
urlFilter.put("/**", "jwt" );
urlFilter.put("/helloworld", "authc,rolse[user]");

1 个答案:

答案 0 :(得分:0)

顺序很重要,您只需要在地图的末尾粘贴let date = new Date(); console.log('UTC' + (-date.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(date.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(date.getTimezoneOffset() / 60)) + ':00' );,请参阅文档中的相关警告: https://shiro.apache.org/web.html#web-ini-configuration