I have tried to follow https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-8.0 but it does not help me when my endpoints are in seperate controllers like so:
namespace CompetencyApp.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EmployeeController : Controller
{
private readonly IEmployeeRepository _employeeRepository;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly IHttpContextAccessor _httpContextAccessor;
public EmployeeController(IEmployeeRepository employeeRepository, IWebHostEnvironment webHostEnvironment, IHttpContextAccessor httpContextAccessor)
{
_employeeRepository = employeeRepository;
_webHostEnvironment = webHostEnvironment;
_httpContextAccessor = httpContextAccessor;
}
[HttpGet]
public IActionResult GetAllEmployees()
{
return Ok(_employeeRepository.GetAllEmployees());
}

The documentation you are referring to is for the minimal apis if you want to use it for controllers then you need do like following
This is just a sample thing but you search with asp.net core with jwt authentication with asp.net identity you will get lots of example.