Adding the [Authorize]
attribute to a controller does not hide the action methods when SecurityTrimming is enabled.
[Authorize]
attribute to a controller: [Authorize]
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult About()
{
return View();
}
@(Html.Kendo().Menu()
.Name("menu")
.SecurityTrimming(st=>{
st.Enabled(true);
})
.Items(i=>{
i.Add().Action("Index", "Home").Text("Index");
i.Add().Action("About", "Home").Text("About");
})
)
The Index and About menu items will not be hidden.
The Index and About menu items should be hidden when the [Authorize]
attribute is added to the controller.