using AspNetCoreApi.Services; using Microsoft.AspNetCore.Mvc; namespace AspNetCoreApi.Controllers { [ApiController] [Route("[controller]")] public class AuthController : ControllerBase { private readonly JWTAuthenticationService _service; public AuthController(JWTAuthenticationService service) { _service = service; } [HttpPost("authenticate")] public async Task Authenticate(string username, string password) { var token = await _service.Authenticate(username, password); if (token == null) { return Unauthorized(); } return Ok(new { Token = token }); } } }