A simple implementation for securing the API by public PASETO access tokens.
services.AddAuthentication()
.AddPasetoBearer(cfg =>
{
});
app.UseAuthentication();
app.UseAuthorization();
And then you can use PasetoBearer authentication scheme in controller with [AuthorizeAttribute]
like this:
[HttpGet]
[Authorize(AuthenticationSchemes = PasetoBearerDefaults.AuthenticationScheme)]
public IActionResult SomeMethod()
{
return Ok();
}