Securing routes with [Authorize] and [AllowAnonymous]?
- [Authorize]: Requires authenticated user
- [Authorize(Roles = "Admin")]: Requires role
- [AllowAnonymous]: Allows access without login
Example:
[Authorize]
public IActionResult Dashboard() { }
[AllowAnonymous]
public IActionResult Login() { }