117 lines
3.7 KiB
C#
117 lines
3.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Api.Models.DTOs
|
|
{
|
|
public class AuthenticateRequest
|
|
{
|
|
[Required]
|
|
public string IdToken { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string Provider { get; set; } = string.Empty; // "Microsoft", "Google", "PocketId"
|
|
|
|
/// <summary>
|
|
/// Optional access token for API calls (e.g., Microsoft Graph)
|
|
/// </summary>
|
|
public string? AccessToken { get; set; }
|
|
}
|
|
|
|
public class AuthenticateResponse
|
|
{
|
|
public string AccessToken { get; set; } = string.Empty;
|
|
public DateTime ExpiresAt { get; set; }
|
|
public UserProfile User { get; set; } = null!;
|
|
public bool IsNewUser { get; set; }
|
|
}
|
|
|
|
public class UserProfile
|
|
{
|
|
public int Id { get; set; }
|
|
public string Email { get; set; } = string.Empty;
|
|
public string? FirstName { get; set; }
|
|
public string? LastName { get; set; }
|
|
public string? ProfilePictureUrl { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime? LastLoginAt { get; set; }
|
|
public List<string> Providers { get; set; } = new List<string>();
|
|
}
|
|
|
|
// User CRUD DTOs
|
|
public class CreateUserRequest
|
|
{
|
|
[Required]
|
|
[EmailAddress]
|
|
[StringLength(255)]
|
|
public string Email { get; set; } = string.Empty;
|
|
|
|
[StringLength(255)]
|
|
public string? FirstName { get; set; }
|
|
|
|
[StringLength(255)]
|
|
public string? LastName { get; set; }
|
|
|
|
[StringLength(500)]
|
|
public string? ProfilePictureUrl { get; set; }
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
}
|
|
|
|
public class UpdateUserRequest
|
|
{
|
|
[StringLength(255)]
|
|
public string? FirstName { get; set; }
|
|
|
|
[StringLength(255)]
|
|
public string? LastName { get; set; }
|
|
|
|
[StringLength(500)]
|
|
public string? ProfilePictureUrl { get; set; }
|
|
|
|
public bool? IsActive { get; set; }
|
|
}
|
|
|
|
public class UserDto
|
|
{
|
|
public int Id { get; set; }
|
|
public string Email { get; set; } = string.Empty;
|
|
public string? FirstName { get; set; }
|
|
public string? LastName { get; set; }
|
|
public string? ProfilePictureUrl { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime? LastLoginAt { get; set; }
|
|
public bool IsActive { get; set; }
|
|
public List<UserOAuthProviderDto> OAuthProviders { get; set; } = new List<UserOAuthProviderDto>();
|
|
}
|
|
|
|
public class UserOAuthProviderDto
|
|
{
|
|
public int Id { get; set; }
|
|
public OAuthProvider Provider { get; set; }
|
|
public string ProviderId { get; set; } = string.Empty;
|
|
public string? ProviderEmail { get; set; }
|
|
public string? ProviderName { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime? LastUsedAt { get; set; }
|
|
}
|
|
|
|
public class JwtSettings
|
|
{
|
|
public string SecretKey { get; set; } = string.Empty;
|
|
public string Issuer { get; set; } = string.Empty;
|
|
public string Audience { get; set; } = string.Empty;
|
|
public int ExpirationMinutes { get; set; } = 60;
|
|
}
|
|
|
|
public class OAuthProviderSettings
|
|
{
|
|
public Dictionary<string, ProviderConfig> Providers { get; set; } = new Dictionary<string, ProviderConfig>();
|
|
}
|
|
|
|
public class ProviderConfig
|
|
{
|
|
public string Authority { get; set; } = string.Empty;
|
|
public string ClientId { get; set; } = string.Empty;
|
|
public string? ClientSecret { get; set; }
|
|
public List<string> ValidAudiences { get; set; } = new List<string>();
|
|
}
|
|
} |