In this section, we are going to test our API key authentication and authorization using Postman. Add a class to your Controllers folder called DividendCalendar. Update the class as follows:
[ApiController]
[Route("api/[controller]")]
public class DividendCalendar : ControllerBase
{
[Authorize(Policy = Policies.Internal)]
[HttpGet("internal")]
public IActionResult GetDividendCalendar()
{
var message = $"Hello from {nameof(GetDividendCalendar)}.";
return new ObjectResult(message);
}
[Authorize(Policy = Policies.External)]
[HttpGet("external")]
public IActionResult External()
{
var message = "External access is currently unavailable.";
return new ObjectResult(message);
}
}
This class will contain all of our dividend calendar API code functionality. Even though external code will not be used in this initial release of our minimum viable...