astral-api/Astral.Core/Entities/RefreshToken.cs

59 lines
1.4 KiB
C#
Raw Normal View History

2024-12-14 17:31:17 +01:00
// <copyright file="RefreshToken.cs" company="alveus.dev">
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
// </copyright>
using Astral.Core.Attributes.EntityAnnotation;
using Astral.Core.Constants;
namespace Astral.Core.Entities;
/// <summary>
/// Refresh token entity.
/// </summary>
[TableMapping("refreshTokens")]
public class RefreshToken
{
/// <summary>
/// Token identifier.
/// </summary>
[PrimaryKey]
[ColumnMapping("token")]
public string Token { get; set; }
/// <summary>
/// User id the token belongs to.
/// </summary>
[ColumnMapping("userId")]
public Guid UserId { get; set; }
/// <summary>
/// Ip address of the agent the token granted to.
/// </summary>
[ColumnMapping("ipAddress")]
public string IpAddress { get; set; }
/// <summary>
/// Session agent role.
/// </summary>
[ColumnMapping("role")]
public UserRole Role { get; set; }
/// <summary>
/// Session token scope.
/// </summary>
[ColumnMapping("scope")]
public TokenScope Scope { get; set; }
/// <summary>
/// When the token expires.
/// </summary>
[ColumnMapping("expires")]
public DateTime Expires { get; set; }
/// <summary>
/// When the token was created.
/// </summary>
[ColumnMapping("createdAt")]
public DateTime CreatedAt { get; set; }
}