Initial endpoint configuration with authentication
This commit is contained in:
31
src/WebApi/Authentication/JwtOptions.cs
Normal file
31
src/WebApi/Authentication/JwtOptions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Vegasco.WebApi.Authentication;
|
||||
|
||||
public class JwtOptions
|
||||
{
|
||||
public const string SectionName = "JWT";
|
||||
|
||||
public string Audience { get; set; } = "";
|
||||
|
||||
public string Authority { get; set; } = "";
|
||||
|
||||
public string Issuer { get; set; } = "";
|
||||
|
||||
public string? NameClaimType { get; set; }
|
||||
}
|
||||
|
||||
public class JwtOptionsValidator : AbstractValidator<JwtOptions>
|
||||
{
|
||||
public JwtOptionsValidator()
|
||||
{
|
||||
RuleFor(x => x.Audience)
|
||||
.NotEmpty();
|
||||
|
||||
RuleFor(x => x.Authority)
|
||||
.NotEmpty();
|
||||
|
||||
RuleFor(x => x.Issuer)
|
||||
.NotEmpty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user