Apache Shiro 使用手册(二) Shiro 认证

2019-01-17 03:59:15王冬梅

ModularRealmAuthenticator 会读取配置在SecurityManager里的Realm。当执行认证是,它会遍历Realm集合,对所有支持提交的token的Realm调用getAuthenticationInfo 。
因此,如果Realm的顺序对你使用的认证策略结果有影响,那么你应该在配置文件中明确定义Realm的顺序,如:


blahRealm = com.company.blah.Realm
...
fooRealm = com.company.foo.Realm
...
barRealm = com.company.another.Realm
securityManager.realms = $fooRealm, $barRealm, $blahRealm

您可能感兴趣的文章:

让Apache Shiro保护你的应用Apache Shiro 使用手册(五) Shiro 配置说明Apache Shiro 使用手册(四) Realm 实现Apache Shiro 使用手册(三) Shiro授权Apache Shiro 使用手册(一) Shiro架构介绍Apache shiro的简单介绍与使用教程(与spring整合使用)