Last active
November 26, 2021 19:55
-
-
Save nmchenry01/a7283d56115a8fe9b7c70851bcde2f3c to your computer and use it in GitHub Desktop.
An example of using the AuthorizeAttribute on a .NET Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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