2024-08-17 16:38:40 +02:00
|
|
|
|
using FluentValidation;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Vegasco.WebApi.Authentication;
|
|
|
|
|
|
|
|
|
|
|
|
public class JwtOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
public const string SectionName = "JWT";
|
|
|
|
|
|
|
2024-08-17 16:38:40 +02:00
|
|
|
|
public string ValidAudience { get; set; } = "";
|
2024-08-17 16:38:40 +02:00
|
|
|
|
|
2024-08-17 16:38:40 +02:00
|
|
|
|
public string MetadataUrl { get; set; } = "";
|
2024-08-17 16:38:40 +02:00
|
|
|
|
|
|
|
|
|
|
public string? NameClaimType { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class JwtOptionsValidator : AbstractValidator<JwtOptions>
|
|
|
|
|
|
{
|
|
|
|
|
|
public JwtOptionsValidator()
|
|
|
|
|
|
{
|
2024-08-17 16:38:40 +02:00
|
|
|
|
RuleFor(x => x.ValidAudience)
|
2024-08-17 16:38:40 +02:00
|
|
|
|
.NotEmpty();
|
|
|
|
|
|
|
2024-08-17 16:38:40 +02:00
|
|
|
|
RuleFor(x => x.MetadataUrl)
|
2024-08-17 16:38:40 +02:00
|
|
|
|
.NotEmpty();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|