Initial commit
This commit is contained in:
17
MealPlan.Api/Models/RefreshToken.cs
Normal file
17
MealPlan.Api/Models/RefreshToken.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace MealPlan.Api.Models;
|
||||
|
||||
/// <summary>
|
||||
/// In-memory refresh token record. Stored in a singleton store rather than the database,
|
||||
/// because the existing schema must not be modified and no migrations may be created.
|
||||
/// Rotation: every successful refresh invalidates the previous token and issues a new one.
|
||||
/// </summary>
|
||||
public class RefreshToken
|
||||
{
|
||||
public string Token { get; set; } = string.Empty;
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
public DateTime ExpiresAtUtc { get; set; }
|
||||
public DateTime CreatedAtUtc { get; set; }
|
||||
public bool IsRevoked { get; set; }
|
||||
|
||||
public bool IsActive => !IsRevoked && DateTime.UtcNow < ExpiresAtUtc;
|
||||
}
|
||||
Reference in New Issue
Block a user