I haven't found a concrete way in MVC 5, yet, to have a simple but powerful way of verifying user authentication.
In Laravel you can easily restrict users via the auth middleware like this:
Route::get('/home', 'HomeController@Index')->middleware('auth');
This requires that the user be logged in or authorized to view the page without having a bunch of nasty logic statements always checking that they are. I'm trying to find out if in ASP.NET MVC 5 there is a similarly simple solution? I know the route will look like this:
public class HomeController : Controller {
public ActionResult Index() {
return View();
}
}
Is there a way to attach something to the ActionResult that will do the same thing for simple authorization in MVC 5?