Add JWT authentication.

Add: JWT authentication in Web API. Related configuration and services are added.
This commit is contained in:
2025-07-10 20:08:48 +08:00
parent 7cce413f79
commit 724b1d4dae
8 changed files with 132 additions and 4 deletions

View File

@ -4,6 +4,7 @@ public record OptixServeSettings
{
public ApiSettings? Api { get; set; } = new();
public DatabaseSettings? Database { get; set; } = new();
public JwtSettings? Jwt { get; set; } = new();
}
public record ApiSettings
@ -12,6 +13,14 @@ public record ApiSettings
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,