Enable authentication

This commit is contained in:
2025-04-21 00:35:36 +02:00
parent 4fd5f71724
commit 1080d3b4ad
10 changed files with 75 additions and 18 deletions

View File

@@ -5,13 +5,15 @@ using Microsoft.AspNetCore.Mvc;
namespace GameIdeas.WebAPI.Controllers;
[ApiController]
[Route("api/[controller]")]
public class UserController(
IUserService userService,
ILoggerFactory loggerFactory) : Controller
{
private readonly ILogger<UserController> logger = loggerFactory.CreateLogger<UserController>();
[HttpPost("login")]
[HttpPost("Login")]
public async Task<ActionResult<TokenDto>> Login([FromBody] UserDto model)
{
try

View File

@@ -7,6 +7,7 @@
"EnterUsername": "Nom d'utilisateur",
"EnterPassword": "Mot de passe",
"UserManager": "Gestion des utilisateurs",
"CategoriesManager": "Gestion des catégories",
"Filters": "Les filtres",
"LastAdd": "Les ajouts récents",
"Research": "Rechercher",

View File

@@ -3,6 +3,7 @@ using GameIdeas.Shared.Model;
using GameIdeas.WebAPI.Context;
using GameIdeas.WebAPI.Services.Categories;
using GameIdeas.WebAPI.Services.Games;
using GameIdeas.WebAPI.Services.Users;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
@@ -63,6 +64,7 @@ services.AddAuthorization();
services.AddSingleton<TranslationService>();
services.AddSingleton<Translations>();
services.AddScoped<IUserService, UserService>();
services.AddScoped<IGameReadService, GameReadService>();
services.AddScoped<IGameWriteService, GameWriteService>();
services.AddScoped<ICategoryService, CategoryService>();