|
@@ -62,10 +62,10 @@ namespace VCommonCoreExample.DataStore
|
|
|
|
|
|
public void ValidateToken(string token, out Guid? tenantId, out Guid userId)
|
|
|
{
|
|
|
- var c = _sessionCache.Get(token);
|
|
|
- if (c == null) throw new VFriendlyException("会话已失效");
|
|
|
- var ek = _sessionCache.GetKickSign(c.TenantId, c.UserId);
|
|
|
- if (c.KickSign != ek)
|
|
|
+ var scm = _sessionCache.Get(token);
|
|
|
+ if (scm == null) throw new VFriendlyException("会话已失效");
|
|
|
+ var ks = _sessionCache.GetKickSign(scm.TenantId, scm.UserId);
|
|
|
+ if (scm.KickSign != ks)
|
|
|
{
|
|
|
_sessionCache.Clear(token);
|
|
|
throw new VFriendlyException("会话已失效:用户已重新登录");
|
|
@@ -73,13 +73,13 @@ namespace VCommonCoreExample.DataStore
|
|
|
|
|
|
//Check exist and tenant/user delete/disable/passChanged
|
|
|
|
|
|
- if (c.TenantId.HasValue && true != _authCache.CheckTenantEnable(c.TenantId.Value))
|
|
|
+ if (scm.TenantId.HasValue && true != _authCache.CheckTenantEnable(scm.TenantId.Value))
|
|
|
{
|
|
|
_sessionCache.Clear(token);
|
|
|
throw new VFriendlyException("会话已失效:租户不存在或未启用");
|
|
|
}
|
|
|
|
|
|
- var ucm = _authCache.GetUser(c.TenantId, c.UserId);
|
|
|
+ var ucm = _authCache.GetUser(scm.TenantId, scm.UserId);
|
|
|
if (null == ucm)
|
|
|
{
|
|
|
_sessionCache.Clear(token);
|
|
@@ -92,17 +92,17 @@ namespace VCommonCoreExample.DataStore
|
|
|
throw new VFriendlyException("会话已失效:用户未启用");
|
|
|
}
|
|
|
|
|
|
- if (c.HashedPassword != ucm.Password)
|
|
|
+ if (scm.HashedPassword != ucm.Password)
|
|
|
{
|
|
|
_sessionCache.Clear(token);
|
|
|
throw new VFriendlyException("会话已失效:密码已变更");
|
|
|
}
|
|
|
|
|
|
// extend expire
|
|
|
- _sessionCache.ExtendExpire(token, c.TenantId, c.UserId, c.Remember ? RememberMeSessionExpireDays : NormalSessionExpireDays);
|
|
|
+ _sessionCache.ExtendExpire(token, scm.TenantId, scm.UserId, scm.Remember ? RememberMeSessionExpireDays : NormalSessionExpireDays);
|
|
|
|
|
|
- tenantId = c.TenantId;
|
|
|
- userId = c.UserId;
|
|
|
+ tenantId = scm.TenantId;
|
|
|
+ userId = scm.UserId;
|
|
|
}
|
|
|
}
|
|
|
}
|