using Kean.Domain.Identity.Events;
using Kean.Domain.Identity.Repositories;
using System.Threading;
using System.Threading.Tasks;
namespace Kean.Domain.Identity.EventHandlers
{
///
/// 身份验证成功时,刷新时间戳
///
public sealed class AuthenticateSuccessEventHandler_Refresh : EventHandler
{
private readonly ISessionRepository _sessionRepository; // 会话仓库
///
/// 依赖注入
///
public AuthenticateSuccessEventHandler_Refresh(
ISessionRepository sessionRepository)
{
_sessionRepository = sessionRepository;
}
///
/// 处理程序
///
public override async Task Handle(AuthenticateSuccessEvent @event, CancellationToken cancellationToken)
{
await _sessionRepository.UpdateSession(@event.Session);
}
}
}