shiro认证过程Authenticator到realm,然后进行认证的过程

来源:互联网 发布:java安卓模拟器 编辑:程序博客网 时间:2024/06/03 20:05
public final AuthenticationInfo getAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {        AuthenticationInfo info = getCachedAuthenticationInfo(token);        if (info == null) {            //otherwise not cached, perform the lookup:            info = doGetAuthenticationInfo(token);//调用自定义realm认证方法            log.debug("Looked up AuthenticationInfo [{}] from doGetAuthenticationInfo", info);            if (token != null && info != null) {                cacheAuthenticationInfoIfPossible(token, info);            }        } else {            log.debug("Using cached authentication info [{}] to perform credentials matching.", info);        }        if (info != null) {            assertCredentialsMatch(token, info);//对token和info进行信息对比        } else {            log.debug("No AuthenticationInfo found for submitted AuthenticationToken [{}].  Returning null.", token);        }        return info;    }

AuthenticatingRealm抽象类中定义了这段代码显示了Authenticator调用自定义的realm,和realm返回AuthenticationInfo后,Authenticator再将用户提交的token信息和realm查询到的info信息进行对比,如果相同则认证成功。





0 0
原创粉丝点击