一、创建过程:

2、判断Authenticatingcache开启缓存,且Authenticatingcache为空
cache = getAuthenticationCacheLazy();
该方法可以调用cachemanager创建
且可以通过名字创建

二、调用流程

核心:
2、进入authenticatingrealm,传入的是token,查看有没有该信息,
1、则调用的是doGetAutenTicationInfo(toke):该方法为实现realm中重写的查询数据库的方法
Object key = getAuthenticationCacheKey(token);
info为doGetAutenTicationInfo(toke)创建的对象
SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(fsConsumerInfo,
fsConsumerInfo.getPassword(), credentialsSalt, getName());
assertCredentialsMatch(token, info);


3、继续获取缓存,并判断是否开启使用使用缓存,若是没有缓存,且开启了缓存,交个cachemanager创建缓存

4、最终获取到缓存
2、开启 true
本文详细解析了Shiro框架中认证缓存(AuthenticatingCache)的工作原理及调用流程,包括缓存的创建、数据获取、密码验证等关键步骤,以及如何配置和扩展缓存。


5685

被折叠的 条评论
为什么被折叠?



