first commit
This commit is contained in:
42
MyNewProjectName.Infrastructure/Options/JwtOptions.cs
Normal file
42
MyNewProjectName.Infrastructure/Options/JwtOptions.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MyNewProjectName.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// JWT authentication configuration options
|
||||
/// </summary>
|
||||
public class JwtOptions
|
||||
{
|
||||
public const string SectionName = "Jwt";
|
||||
|
||||
/// <summary>
|
||||
/// Secret key for signing JWT tokens
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT SecretKey is required")]
|
||||
[MinLength(32, ErrorMessage = "JWT SecretKey must be at least 32 characters long")]
|
||||
public string SecretKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token issuer
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT Issuer is required")]
|
||||
public string Issuer { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token audience
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT Audience is required")]
|
||||
public string Audience { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token expiration time in minutes
|
||||
/// </summary>
|
||||
[Range(1, 1440, ErrorMessage = "ExpirationInMinutes must be between 1 and 1440 (24 hours)")]
|
||||
public int ExpirationInMinutes { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// Refresh token expiration time in days
|
||||
/// </summary>
|
||||
[Range(1, 365, ErrorMessage = "RefreshTokenExpirationInDays must be between 1 and 365")]
|
||||
public int RefreshTokenExpirationInDays { get; set; } = 7;
|
||||
}
|
||||
Reference in New Issue
Block a user