3a7edb23c7
Upgraded projects to .NET 9.0 and added new projects `KBR.Cache`, `KBR.Shared`, and `KBR.Shared.Lite` to the solution. Introduced JWT authentication and OTP handling with new models, services, and configuration options. Updated database schema with new entities `Users` and `RefreshTokens`, and added migrations for schema changes. Implemented caching strategies using `AppDistributedCache` with support for in-memory, SQL Server, and Redis. Enhanced email handling with `MailHelpers` for domain replacement. Updated controllers, repositories, and configuration files to support new features.
34 lines
864 B
C#
34 lines
864 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace PortBlog.API.Entities
|
|
{
|
|
public class RefreshToken
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public int TokenId { get; set; }
|
|
|
|
[Required]
|
|
public int UserId { get; set; }
|
|
|
|
[Required]
|
|
public string Token { get; set; }
|
|
|
|
[Required]
|
|
public string JwtId { get; set; }
|
|
|
|
[Required]
|
|
public DateTime ExpiryDate { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public bool Revoked { get; set; } = false;
|
|
public string? ReplacedByToken { get; set; }
|
|
|
|
[Required]
|
|
public string DeviceInfo { get; set; }
|
|
|
|
[ForeignKey(nameof(UserId))]
|
|
public User User { get; set; }
|
|
}
|
|
}
|