Initial commit
This commit is contained in:
16
MealPlan.Api/DTOs/Auth/LoginRequestDto.cs
Normal file
16
MealPlan.Api/DTOs/Auth/LoginRequestDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MealPlan.Api.DTOs.Auth;
|
||||
|
||||
/// <summary>Credentials submitted to <c>POST /api/auth/login</c>.</summary>
|
||||
public class LoginRequestDto
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[MaxLength(256)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(256)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
10
MealPlan.Api/DTOs/Auth/RefreshRequestDto.cs
Normal file
10
MealPlan.Api/DTOs/Auth/RefreshRequestDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MealPlan.Api.DTOs.Auth;
|
||||
|
||||
/// <summary>Body for <c>POST /api/auth/refresh</c> and <c>POST /api/auth/logout</c>.</summary>
|
||||
public class RefreshRequestDto
|
||||
{
|
||||
[Required]
|
||||
public string RefreshToken { get; set; } = string.Empty;
|
||||
}
|
||||
20
MealPlan.Api/DTOs/Auth/RegisterRequestDto.cs
Normal file
20
MealPlan.Api/DTOs/Auth/RegisterRequestDto.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MealPlan.Api.DTOs.Auth;
|
||||
|
||||
/// <summary>Payload for <c>POST /api/auth/register</c>.</summary>
|
||||
public class RegisterRequestDto
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[MaxLength(256)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(256)]
|
||||
public string? UserName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(8)]
|
||||
[MaxLength(256)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
13
MealPlan.Api/DTOs/Auth/TokenResponseDto.cs
Normal file
13
MealPlan.Api/DTOs/Auth/TokenResponseDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace MealPlan.Api.DTOs.Auth;
|
||||
|
||||
/// <summary>Token pair returned by login and refresh.</summary>
|
||||
public class TokenResponseDto
|
||||
{
|
||||
public string AccessToken { get; set; } = string.Empty;
|
||||
public string RefreshToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Access-token lifetime in seconds (clients use it to schedule silent refresh).</summary>
|
||||
public int ExpiresInSeconds { get; set; }
|
||||
|
||||
public string TokenType { get; set; } = "Bearer";
|
||||
}
|
||||
9
MealPlan.Api/DTOs/Auth/UserInfoDto.cs
Normal file
9
MealPlan.Api/DTOs/Auth/UserInfoDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MealPlan.Api.DTOs.Auth;
|
||||
|
||||
/// <summary>Current-user payload returned by <c>GET /api/auth/me</c>.</summary>
|
||||
public class UserInfoDto
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string? UserName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user