autobus-api_old/AutobusApi.Application/Identity/Commands/RenewAccessToken/RenewAccessTokenCommandHandler.cs

23 lines
724 B
C#

using AutobusApi.Application.Common.Interfaces;
using AutobusApi.Application.Common.Models.Identity;
using MediatR;
namespace AutobusApi.Application.Identity.Commands.RenewAccessToken;
public class RenewAccessTokenCommandHandler : IRequestHandler<RenewAccessTokenCommand, TokensModel>
{
private readonly IIdentityService _identityService;
public RenewAccessTokenCommandHandler(IIdentityService identityService)
{
_identityService = identityService;
}
public async Task<TokensModel> Handle(
RenewAccessTokenCommand request,
CancellationToken cancellationToken)
{
return await _identityService.RenewAccessTokenAsync(request.RefreshToken, cancellationToken);
}
}