Closed XilongPei closed 6 years ago
` protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
// 默认用户拥有所有权限
Set<String> functionCodes = functionService.getAllFunctionCode();
/* Set<String> functionCodes=functionService.getFunctionCodeSet(roleCodes); */
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
`
How to prevent accessing a Servlet unauthenticated with Apache Shiro? https://stackoverflow.com/questions/26959357/how-to-prevent-accessing-a-servlet-unauthenticated-with-apache-shiro
Apache Shiro 使用手册(五)Shiro 配置说明 http://kdboy.iteye.com/blog/1169637
使用shiro的时候,比较常用的filter有anon,authc,roles和perms。当我们想定义某个链接是拥有某些权限的用户才可以访问的时候,我们可以这样定义。/xx = roles[A,B]。在shiro中,表示当前用户同时拥有A,B两种角色才可以访问/xx这个链接,是一种&&(与)的关系,我们可以看看源码。
restrict /druid/** access rights, only roles[ADMIN] can access it commit: https://github.com/XilongPei/Openparts/commit/43346b1bcb51fb968ca3d97a86a49b1caa9104e2
web.xml中,增加了如下内容
未把它授权给任何一个用户,结果所有登录后的用户都可以访问到它。