private bool ValidateTokenValidityKey(Claim tokenValidityKeyClaim, UserIdentifier userIdentifier)
{
bool isValid;
using (var unitOfWorkManager = IocManager.Instance.ResolveAsDisposable<IUnitOfWorkManager>())
{
using (var uow = unitOfWorkManager.Object.Begin())
{
using (unitOfWorkManager.Object.Current.SetTenantId(userIdentifier.TenantId))
{
using (var userManager = IocManager.Instance.ResolveAsDisposable<UserManager>())
{
var userManagerObject = userManager.Object;
var user = userManagerObject.GetUser(userIdentifier);
isValid = AsyncHelper.RunSync(() => userManagerObject.IsTokenValidityKeyValidAsync(user, tokenValidityKeyClaim.Value));
uow.Complete();
}
}
}
}
建议改进一下排版,支持markdown语法
– dudu 3年前