using Application.Services.Jwt; using FluentValidation; namespace Application.Endpoints.Authorization.RefreshToken; public class RefreshJwtValidator : AbstractValidator { private readonly IJwtService _jwtService; public RefreshJwtValidator(IJwtService jwtService) { _jwtService = jwtService; RuleFor(x => x.Token) .NotEmpty().WithMessage("Token is required.") .Must(BeAValidToken).WithMessage("Token is invalid or expired."); } private bool BeAValidToken(string token) { return _jwtService.ValidateJwtToken(token); } }