galaeth-draft/Galaeth.Core/Entities/RefreshToken.cs

62 lines
1.5 KiB
C#
Raw Permalink Normal View History

2024-11-17 10:31:01 +01:00
using Galaeth.Core.Attributes.EntityAnnotation;
using Galaeth.Core.Constants;
using MyCSharp.HttpUserAgentParser;
namespace Galaeth.Core.Entities;
/// <summary>
/// Entity representing a refresh token.
/// </summary>
[TableMapping("refreshTokens")]
public class RefreshToken
{
/// <summary>
/// The token.
/// </summary>
[ColumnMapping("token")]
[PrimaryKey]
public string Token { get; set; }
/// <summary>
/// Token context.
/// </summary>
[ColumnMapping("tokenContext")]
public RefreshTokenContext TokenContext { get; set; }
/// <summary>
/// The owner user's id.
/// </summary>
[ColumnMapping("userId")]
public Guid UserId { get; set; }
/// <summary>
/// When the token expires.
/// </summary>
[ColumnMapping("expires")]
public DateTime Expires { get; set; }
/// <summary>
/// The user agent this refresh token belongs to.
/// </summary>
[ColumnMapping("userAgent")]
public string UserAgent { get; set; }
/// <summary>
/// User agent type.
/// </summary>
[ColumnMapping("userAgentType")]
public HttpUserAgentType UserAgentType { get; set; }
/// <summary>
/// The ip address this refresh token belongs to.
/// </summary>
[ColumnMapping("ipAddress")]
public string IpAddress { get; set; }
/// <summary>
/// When the token was created.
/// </summary>
[ColumnMapping("createdAt")]
public DateTime CreatedAt { get; set; }
}