Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Last active November 26, 2021 19:55
Show Gist options
  • Save nmchenry01/a7283d56115a8fe9b7c70851bcde2f3c to your computer and use it in GitHub Desktop.
Save nmchenry01/a7283d56115a8fe9b7c70851bcde2f3c to your computer and use it in GitHub Desktop.
An example of using the AuthorizeAttribute on a .NET Controller
[ApiController]
public class ProductController : ControllerBase
{
[HttpGet("product/{Id}")]
[Authorize]
public ActionResult Get(int Id)
{
// Get some product by ID
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment