using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.Data; using Microsoft.AspNetCore.Mvc; using Trazo.Model; namespace Trazo.Controllers; [ApiController] [Route("api/[controller]")] public class AuthController( SignInManager _signInManager, UserManager _userManager, IConfiguration _configuration ) : ControllerBase { [HttpPost("login")] public async Task Login([FromBody] LoginRequest request) { var result = await _signInManager.PasswordSignInAsync( request.Email, request.Password, false, false); if (!result.Succeeded) return Unauthorized(); // Generate your JWT here return Ok(new { token = "your-jwt-token" }); } [Authorize] [HttpPost("logout")] public async Task Logout() { await _signInManager.SignOutAsync(); return Ok(); } }