要解决Apache Shiro中通配符权限不起作用的问题,可以尝试以下解决方法:
/**
表示匹配任意路径。[urls]
/** = authc
perms["user:create"]
表示需要user:create
权限。@RequiresPermissions("user:create")
public void createUser() {
// code here
}
@RequiresPermissions
注解,确保它们按照正确的顺序排列。@RequiresPermissions("user:create")
@RequiresPermissions("user:read")
public void getUser() {
// code here
}
检查权限字符串匹配规则:确保权限字符串与实际权限匹配。例如,权限字符串是大小写敏感的,所以确保在代码中使用的权限字符串与配置文件中的权限字符串完全匹配。
检查Shiro版本:如果以上方法都没有解决问题,可能是由于Shiro的版本问题。尝试升级Shiro到最新版本,或者降级到一个已知可用的版本。
希望以上解决方法能够帮助您解决Apache Shiro中通配符权限不起作用的问题。如果问题仍然存在,请提供更多的代码示例和错误信息,以便我们更好地帮助您解决问题。
上一篇:Apache Shiro中的ThreadContext#bind(Subject)与ThreadContext.bind(SecurityManager)之间的区别是什么?
下一篇:Apache SIS数据库 'classpath:SIS_DATA/Databases/SpatialMetadata' 未找到。