27 lines
712 B
C#
27 lines
712 B
C#
using Microsoft.Extensions.Options;
|
|||
|
|
|
||
|
|
namespace FiscalOS.API.Login;
|
||
|
|
|
||
|
|
internal sealed record JwtOptions
|
||
|
|
{
|
||
|
|
public string Issuer { get; init; } = string.Empty;
|
||
|
|
public string Audience { get; init; } = string.Empty;
|
||
|
|
public string Secret { get; init; } = string.Empty;
|
||
|
|
public int ExpiryInMinutes { get; init; } = 5;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal sealed record JwtOptionsSetup : IConfigureOptions<JwtOptions>
|
||
|
|
{
|
||
|
|
private const string SectionName = nameof(JwtOptions);
|
||
|
|
private readonly IConfiguration _configuration;
|
||
|
|
|
||
|
|
public JwtOptionsSetup(IConfiguration configuration)
|
||
|
|
{
|
||
|
|
_configuration = configuration;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Configure(JwtOptions options)
|
||
|
|
{
|
||
|
|
_configuration.GetSection(SectionName).Bind(options);
|
||
|
|
}
|
||
|
|
}
|