- Fix MSTest compatibility with .NET 9.0 by upgrading to MSTest.TestFramework 4.2.3 - Move Tests directory to solution level (Tests/) to prevent test files from being compiled with GermanApp - Update test project references to point to GermanApp/GermanApp.csproj - Add InternalsVisibleTo attributes for test assemblies - Make RefreshToken properties internal for testability - Fix User.ChangeEmail null handling - Add 46 comprehensive unit tests for User and RefreshToken domain entities - All tests passing successfully Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using GermanApp.Application.DTOs.Auth;
|
|
using GermanApp.Domain.Entities;
|
|
|
|
namespace GermanApp.Application.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Interface for authentication services.
|
|
/// Part of the Application layer.
|
|
/// </summary>
|
|
public interface IAuthService
|
|
{
|
|
/// <summary>
|
|
/// Registers a new user.
|
|
/// </summary>
|
|
/// <param name="registerDto">User registration data</param>
|
|
/// <returns>Authentication response with token</returns>
|
|
Task<AuthResponse> RegisterAsync(RegisterDto registerDto);
|
|
|
|
/// <summary>
|
|
/// Authenticates a user and returns a JWT token.
|
|
/// </summary>
|
|
/// <param name="loginDto">User login data</param>
|
|
/// <returns>Authentication response with token</returns>
|
|
Task<AuthResponse> LoginAsync(LoginDto loginDto);
|
|
|
|
/// <summary>
|
|
/// Gets the current authenticated user.
|
|
/// </summary>
|
|
/// <param name="userId">User ID from token claims</param>
|
|
/// <returns>The user entity</returns>
|
|
Task<User?> GetCurrentUserAsync(int userId);
|
|
|
|
/// <summary>
|
|
/// Refreshes the access token using a refresh token.
|
|
/// </summary>
|
|
/// <param name="refreshToken">The refresh token</param>
|
|
/// <returns>New access token and refresh token</returns>
|
|
Task<RefreshTokenResponse> RefreshTokenAsync(string refreshToken);
|
|
|
|
/// <summary>
|
|
/// Revokes a refresh token.
|
|
/// </summary>
|
|
/// <param name="refreshToken">The refresh token to revoke</param>
|
|
Task RevokeRefreshTokenAsync(string refreshToken);
|
|
}
|