Add: JWT authentication in Web API. Related configuration and services are added.
34 lines
823 B
C#
34 lines
823 B
C#
namespace OptixServe.Api.Configuration;
|
|
|
|
public record OptixServeSettings
|
|
{
|
|
public ApiSettings? Api { get; set; } = new();
|
|
public DatabaseSettings? Database { get; set; } = new();
|
|
public JwtSettings? Jwt { get; set; } = new();
|
|
}
|
|
|
|
public record ApiSettings
|
|
{
|
|
public string? Listen { get; set; } = "127.0.0.1";
|
|
public int? Port { get; set; } = 10086;
|
|
}
|
|
|
|
public record JwtSettings
|
|
{
|
|
public string Secret { get; set; } = string.Empty;
|
|
public string Issuer { get; set; } = "OptixServe";
|
|
public string Audience { get; set; } = "OptixServeUsers";
|
|
public int TokenExpirationMinutes { get; set; } = 60;
|
|
}
|
|
|
|
public enum DatabaseType
|
|
{
|
|
Sqlite,
|
|
MySQL
|
|
}
|
|
|
|
public record DatabaseSettings
|
|
{
|
|
public DatabaseType Type { get; set; } = DatabaseType.Sqlite;
|
|
public string? Host { get; set; }
|
|
} |