# Security Trimming

The Telerik UI Menu has a built-in security trimming functionality which is enabled by default.

If the URL to which the Menu item points is not authorized, the item is hidden.

Security trimming depends on the [ASP.NET MVC Authorization](http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-7). Authorization in MVC is controlled through the [`AuthorizeAttribute`](http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.aspx) attribute and its various parameters. At its simplest applying the AuthorizeAttribute attribute to a controller or action limits access to the controller or action to any authenticated user. For more information, refer to the article on [ASP.NET MVC Authorization](https://docs.microsoft.com/en-us/aspnet/web-api/overview/older-versions/using-web-api-1-with-entity-framework-5/using-web-api-with-entity-framework-part-4#add-authorization).

The Menu hides an item if the [`OnAuthorization`](http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.onauthorization.aspx) method returns
[`HttpUnauthorizedResult`](http://msdn.microsoft.com/en-us/library/system.web.mvc.httpunauthorizedresult.aspx).

[This GitHub project](https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Areas/MenuSecurityTrimming) is representing the usage of the `AuthorizeAttribute`.

The security trimming functionality can be enabled through the `SecurityTrimming` property.

```Razor HtmlHelper
    @(Html.Kendo().Menu()
        .Name("MainMenu")
        .SecurityTrimming(true)
    )
```

## See Also

* [Basic Usage of the Menu HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/menu)
* [MenuItemBuilder Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/kendo.mvc.ui.fluent/menuitembuilder)
* [MenuBuilder Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/kendo.mvc.ui.fluent/menubuilder)
* [Menu Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/menu)
