diff --git a/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs b/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs index efbf93ad94..2d961ad824 100644 --- a/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs @@ -4,7 +4,7 @@ using Bit.Core.Utilities; namespace Bit.Api.SecretsManager.Models.Request; -public class AccessTokenCreateRequestModel +public class AccessTokenCreateRequestModel : IValidatableObject { [Required] [EncryptedString] @@ -34,4 +34,13 @@ public class AccessTokenCreateRequestModel EncryptedPayload = EncryptedPayload, }; } + + public IEnumerable Validate(ValidationContext validationContext) + { + if (ExpireAt != null && ExpireAt <= DateTime.UtcNow) + { + yield return new ValidationResult( + $"Please select an expiration date that is in the future."); + } + } }