Skip to content

Commit

Permalink
Database authentication models.
Browse files Browse the repository at this point in the history
  • Loading branch information
o.nadymov committed Feb 23, 2024
1 parent bc8e0d6 commit fe4f289
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Spoleto.BookApi.Interfaces/Models/Auth/BearerToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Spoleto.BookApi.Interfaces.Models.Auth
{
/// <summary>
/// The Bearer token.
/// </summary>
public class BearerToken
{
/// <summary>
/// Gets or sets the access token.
/// </summary>
public string AccessToken { get; set; }

/// <summary>
/// Gets or sets the refresh token.
/// </summary>
public string RefreshToken { get; set; }
}
}
40 changes: 40 additions & 0 deletions src/Spoleto.BookApi.Interfaces/Models/Auth/RefreshToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;

namespace Spoleto.BookApi.Interfaces.Models.Auth
{
/// <summary>
/// The refresh token.
/// </summary>
public class RefreshToken : PersistentObjectBase
{
/// <summary>
/// Gets or sets the hash value for this refresh token.
/// </summary>
public string ValueToken { get; set; }

/// <summary>
/// Gets or sets the active flag of this token.
/// </summary>
public bool Active { get; set; }

/// <summary>
/// Gets or sets the date issued in UTC of this token.
/// </summary>
public DateTime DateIssued { get; set; }

/// <summary>
/// Gets or sets the date expires in UTC of this token.
/// </summary>
public DateTime DateExpires { get; set; }

/// <summary>
/// Gets or sets the target user identifier for this refresh token.
/// </summary>
public Guid UserId { get; set; }

/// <summary>
/// Gets or sets the target user for this refresh token.
/// </summary>
public User User { get; set; }
}
}
46 changes: 46 additions & 0 deletions src/Spoleto.BookApi.Interfaces/Models/Auth/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace Spoleto.BookApi.Interfaces.Models.Auth
{
/// <summary>
/// The user for database authentication.
/// </summary>
public class User : PersistentObjectBase
{
/// <summary>
/// Gets or sets the user's first name.
/// </summary>
public string FirstName { get; set; }

/// <summary>
/// Gets or sets the user's middle name. Optional, can be null if not provided.
/// </summary>
public string MiddleName { get; set; }

/// <summary>
/// Gets or sets the user's last name. Optional, can be null if not provided.
/// </summary>
public string LastName { get; set; }

/// <summary>
/// Gets or sets the user's phone number.
/// </summary>
/// <remarks>
/// It is required if <see cref="Email"/> is not initialized.<br/>
/// In this case <see cref="Phone"/> is expected to be unique.
/// </remarks>
public string Phone { get; set; }

/// <summary>
/// Gets or sets the user's email address.
/// </summary>
/// <remarks>
/// It is required if <see cref="Phone"/> is not initialized.<br/>
/// In this case <see cref="Email"/> is expected to be unique.
/// </remarks>
public string Email { get; set; }

/// <summary>
/// Gets or sets the user's password (hash).
/// </summary>
public string Password { get; set; }
}
}

0 comments on commit fe4f289

Please sign in to comment.