59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
|
// <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; }
|
||
|
}
|