Last active
November 28, 2021 15:43
-
-
Save nmchenry01/936f96b77bd886ee255d1b5d0a0ab749 to your computer and use it in GitHub Desktop.
An example of using the AuthorizeAttribute with admin authorization 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 AdminProductController : ControllerBase | |
{ | |
[HttpPost("product/{Id}")] | |
[Authorize("admin")] | |
public ActionResult Post(AddProductRequestDto addProductRequest) | |
{ | |
// Add some product | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment