| | | 1 | | using ArturRios.Heimdall.Shared.Messages; |
| | | 2 | | using ArturRios.Heimdall.Shared.Time; |
| | | 3 | | using FluentValidation; |
| | | 4 | | |
| | | 5 | | namespace ArturRios.Heimdall.Command.Input.Validation; |
| | | 6 | | |
| | | 7 | | /// <summary>UC-53 AF-53c: an expiry, when given, must lie in the future — read as UTC when it has no offset.</summary> |
| | | 8 | | public class IssueApplicationCredentialCommandValidator : AbstractValidator<IssueApplicationCredentialCommand> |
| | | 9 | | { |
| | 21 | 10 | | public IssueApplicationCredentialCommandValidator() |
| | | 11 | | { |
| | 21 | 12 | | RuleFor(command => command.ExpiresAt) |
| | 24 | 13 | | .Must(expiresAt => expiresAt is null || UtcInstant.Of(expiresAt.Value) > DateTime.UtcNow) |
| | 21 | 14 | | .WithMessage(ApplicationCredentialMessages.ExpiryNotInFuture); |
| | 21 | 15 | | } |
| | | 16 | | } |