| | | 1 | | using FluentValidation; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Jwt; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Validates <see cref="JwtConfiguration"/> instances, ensuring they carry the values required to create a valid token. |
| | | 7 | | /// </summary> |
| | | 8 | | public class JwtConfigurationValidator : AbstractValidator<JwtConfiguration> |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Initializes a new instance of the <see cref="JwtConfigurationValidator"/> class and configures its validation ru |
| | | 12 | | /// </summary> |
| | 7 | 13 | | public JwtConfigurationValidator() |
| | 7 | 14 | | { |
| | 7 | 15 | | RuleFor(config => config.Audience).NotEmpty(); |
| | 7 | 16 | | RuleFor(config => config.Issuer).NotEmpty(); |
| | 7 | 17 | | RuleFor(config => config.ExpirationInSeconds).NotEmpty().GreaterThan(0); |
| | 7 | 18 | | RuleFor(config => config.Secret).NotEmpty(); |
| | 7 | 19 | | RuleFor(config => config.Claims).NotEmpty(); |
| | 7 | 20 | | } |
| | | 21 | | } |