feat: 完成双token刷新
This commit is contained in:
@@ -190,25 +190,21 @@ namespace Yi.Framework.Rbac.Domain.Managers
|
||||
{
|
||||
//此处优先从缓存中获取
|
||||
UserRoleMenuDto output = null;
|
||||
var tokenExpiresMinuteTime =
|
||||
LazyServiceProvider.GetRequiredService<IOptions<JwtOptions>>().Value.ExpiresMinuteTime;
|
||||
var tokenExpiresSecondTime =
|
||||
LazyServiceProvider.GetRequiredService<IOptions<JwtOptions>>().Value.ExpiresSecondTime;
|
||||
var cacheData = await _userCache.GetOrAddAsync(new UserInfoCacheKey(userId),
|
||||
async () =>
|
||||
{
|
||||
var user = await _userRepository.GetUserAllInfoAsync(userId);
|
||||
var data = EntityMapToDto(user);
|
||||
//系统用户数据被重置,老前端访问重新授权
|
||||
if (data is null)
|
||||
{
|
||||
throw new AbpAuthorizationException();
|
||||
}
|
||||
|
||||
//data.Menus.Clear();
|
||||
output = data;
|
||||
output = data ?? throw new AbpAuthorizationException();
|
||||
return new UserInfoCacheItem(data);
|
||||
},
|
||||
() => new DistributedCacheEntryOptions
|
||||
{ AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(tokenExpiresMinuteTime) });
|
||||
{ AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(tokenExpiresSecondTime) });
|
||||
|
||||
if (cacheData is not null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user