From 16a6f83ef4f773b6a3d045e2e025767127dfba83 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 23 Oct 2017 11:22:54 -0400 Subject: [PATCH] Adding Auth (#62) * Refactoring ViewModels into Razor Pages models * Cleaning up Basket viewcomponent * Refactoring services. Fixed bug in basket item counter. * Adding Auth filters to Web and WebWithRazor --- src/Web/Controllers/AccountController.cs | 1 + src/WebRazorPages/Startup.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Web/Controllers/AccountController.cs b/src/Web/Controllers/AccountController.cs index ca0136745..89f08cfd7 100644 --- a/src/Web/Controllers/AccountController.cs +++ b/src/Web/Controllers/AccountController.cs @@ -11,6 +11,7 @@ namespace Microsoft.eShopWeb.Controllers { [Route("[controller]/[action]")] + [Authorize] public class AccountController : Controller { private readonly UserManager _userManager; diff --git a/src/WebRazorPages/Startup.cs b/src/WebRazorPages/Startup.cs index 60ba8be50..743dc9483 100644 --- a/src/WebRazorPages/Startup.cs +++ b/src/WebRazorPages/Startup.cs @@ -104,7 +104,11 @@ public void ConfigureServices(IServiceCollection services) // Add memory cache services services.AddMemoryCache(); - services.AddMvc(); + services.AddMvc() + .AddRazorPagesOptions(options => + { + options.Conventions.AuthorizeFolder("/Order"); + }); _services = services; }