You have two options
-
Controller level by decorating your controller with authorize attribute.
[Authorize] [RoutePrefix("api/account")] public class AccountController : ApiController { -
You can also set it global level to all routes, in
Registermethod of WebApiConfig.cs fileconfig.Filters.Add(new AuthorizeAttribute());