DeutschLernen/GermanApp/Application/Interfaces/IAuthService.cs
Lasse Rune Hansen 50f1b8a8dc feat(backend): Implement mandatory authentication and admin module
- Add Role property to User entity with migration
- Create BootstrapController for first admin user creation
- Remove [AllowAnonymous] from all learning content controllers
- Create AdminController with admin-only endpoints
- Create AdminService for user management
- Create UserReportService for progress reports
- Add UserRepository implementation
- Update AuthService with role support

feat(frontend): Implement authentication system
- Add AuthStore with React context for auth state management
- Create Login, Register, Landing, and Home pages
- Add ProtectedRoute and AdminRoute components
- Create Auth API types and client
- Configure Vite with @/ path alias
- Add comprehensive CSS styles for auth and landing pages

BREAKING CHANGE: All learning content now requires authentication.
Users must register and sign in before accessing lessons, quizzes, and stories.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-14 12:42:15 +02:00

59 lines
2 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);
/// <summary>
/// Creates the first admin user (bootstrap).
/// This is a special method that creates an admin user without requiring authentication.
/// </summary>
/// <param name="registerDto">Admin user registration data</param>
/// <returns>Authentication response with token</returns>
Task<AuthResponse> CreateAdminUserAsync(RegisterDto registerDto);
/// <summary>
/// Checks if an admin user already exists.
/// </summary>
/// <returns>True if admin user exists, false otherwise</returns>
Task<bool> AdminUserExistsAsync();
}