1提交认证 被DefaultSecurityManager 的login 方法拦截 根据AuthenticationToken获取 AuthenticationInfo
2 进入 AbstractAuthenticator authenticate 方法 获取 AuthenticationInfo---> 进入ModularRealmAuthenticator doAuthenticate 方法获取 AuthenticationInfo --》doSingleRealmAuthentication 方法真是的获取
--》AuthenticatingRealm 进入AuthenticationInfo 方法 获取AuthenticationInfo --》》回调到自己定义的ShiroDbRealm(继承了 AuthorizingRealm的自定义那个类)的doGetAuthenticationInfo 获取数据库中的记录与AuthenticationInfo(具体实现类为SimpleAuthenticationInfo 在这里盐值会被2次处理)
得到AuthenticationInfo 后 进入真正密码验证阶段 AuthenticatingRealm 的assertCredentialsMatch方法 进入doCredentialsMatch方法-》将用户提交的用户名密码 编码hashProvidedCredentials方法-->hashProvidedCredentials-》》hashProvidedCredentials 对盐值以及对提交的密码进行处理,
得到一个处理结果(主要为密码的处理结果值),最后用这个值的字节码与数据库中值的字节码进行比较如果相同则登录成功 如果不同则失败。
2 进入 AbstractAuthenticator authenticate 方法 获取 AuthenticationInfo---> 进入ModularRealmAuthenticator doAuthenticate 方法获取 AuthenticationInfo --》doSingleRealmAuthentication 方法真是的获取
--》AuthenticatingRealm 进入AuthenticationInfo 方法 获取AuthenticationInfo --》》回调到自己定义的ShiroDbRealm(继承了 AuthorizingRealm的自定义那个类)的doGetAuthenticationInfo 获取数据库中的记录与AuthenticationInfo(具体实现类为SimpleAuthenticationInfo 在这里盐值会被2次处理)
得到AuthenticationInfo 后 进入真正密码验证阶段 AuthenticatingRealm 的assertCredentialsMatch方法 进入doCredentialsMatch方法-》将用户提交的用户名密码 编码hashProvidedCredentials方法-->hashProvidedCredentials-》》hashProvidedCredentials 对盐值以及对提交的密码进行处理,
得到一个处理结果(主要为密码的处理结果值),最后用这个值的字节码与数据库中值的字节码进行比较如果相同则登录成功 如果不同则失败。