refactor: Client 工程重构权限方式

This commit is contained in:
Argo Zhang 2019-10-10 14:16:33 +08:00
parent 38388148bc
commit 20d9dad2ee
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
3 changed files with 5 additions and 6 deletions

View File

@ -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
/// 运维管理接口
/// </summary>
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class AdminController : ControllerBase
{

View File

@ -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
/// <summary>
/// 前台主页控制器
/// </summary>
[Authorize]
public class HomeController : Controller
{
/// <summary>

View File

@ -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());
}
}
}