在Shiro文档中,它们在shiro.ini中配置全局shiro.ini(参见permissionResolver )。
globalPermissionResolver = com.foo.bar.authz.MyPermissionResolver
...
securityManager.authorizer.permissionResolver = $globalPermissionResolver但是,我使用的是Guice,所以我不想依赖于shiro.ini。我知道我可以在我的setPermissionResolver()中调用Realm,但是我不想这样做,因为我有多个Realm。
有什么想法吗?谢谢。
发布于 2014-09-19 19:23:57
事实证明,通过更仔细地阅读上面提到的文档,它会说:
If you want to configure a global PermissionResolver, each Realm that is to receive the configured PermissionResolver must implement the PermisionResolverAware interface. This guarantees that the configured instance can be relayed to each Realm that supports such configuration.
另外,AuthorizingRealm已经实现了这个接口,所以所有授权领域都应该能够获得一个PermissionsResolver。
为了将它与Guice绑定,我将其添加到我的ShiroWebModule中
bind(PermissionResolver.class).to(MyPermissionResolver.class).in(Singleton.class);https://stackoverflow.com/questions/25675533
复制相似问题