From 20d9dad2eebe18ff68411a3f1389286d3fbb55d4 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 10 Oct 2019 14:16:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20Client=20=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=9D=83=E9=99=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.Client/Controllers/Api/AdminController.cs | 4 +++- src/client/Bootstrap.Client/Controllers/HomeController.cs | 2 +- src/client/Bootstrap.Client/Startup.cs | 5 +---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/client/Bootstrap.Client/Controllers/Api/AdminController.cs b/src/client/Bootstrap.Client/Controllers/Api/AdminController.cs index 3acf7701..719fbe8c 100644 --- a/src/client/Bootstrap.Client/Controllers/Api/AdminController.cs +++ b/src/client/Bootstrap.Client/Controllers/Api/AdminController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; namespace Bootstrap.Client.Controllers.Api { @@ -6,6 +7,7 @@ namespace Bootstrap.Client.Controllers.Api /// 运维管理接口 /// [Route("api/[controller]")] + [Authorize] [ApiController] public class AdminController : ControllerBase { diff --git a/src/client/Bootstrap.Client/Controllers/HomeController.cs b/src/client/Bootstrap.Client/Controllers/HomeController.cs index c837e0b8..84eddf82 100644 --- a/src/client/Bootstrap.Client/Controllers/HomeController.cs +++ b/src/client/Bootstrap.Client/Controllers/HomeController.cs @@ -1,5 +1,4 @@ using Bootstrap.Client.Models; -using Bootstrap.Client.Tasks; using Longbow.Configuration; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Authentication.Cookies; @@ -13,6 +12,7 @@ namespace Bootstrap.Client.Controllers /// /// 前台主页控制器 /// + [Authorize] public class HomeController : Controller { /// diff --git a/src/client/Bootstrap.Client/Startup.cs b/src/client/Bootstrap.Client/Startup.cs index 39e34eec..1aee57ae 100644 --- a/src/client/Bootstrap.Client/Startup.cs +++ b/src/client/Bootstrap.Client/Startup.cs @@ -91,10 +91,7 @@ namespace Bootstrap.Client app.UseAuthorization(); app.UseCacheManager(); app.UseOnlineUsers(callback: TraceHelper.Save); - app.UseEndpoints(endpoints => - { - endpoints.MapDefaultControllerRoute().RequireAuthorization(); - }); + app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute()); } } }