From a6af9f2db710ceed4585ea5c77cb265427ca939c Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Wed, 16 Sep 2026 14:02:18 +0200 Subject: [PATCH] =?UTF-8?q?Indul=C3=A1skor=20=C3=A1tmenjen=20a=20middlewar?= =?UTF-8?q?eon=20a=20bejelentkez=C3=A9shez=20sz=C3=BCks=C3=A9ges=20elemek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CheckListController.cs | 48 +++++++++---------- .../Middleware/JwtMiddleware.cs | 10 ++++ .../Services/CheckListService.cs | 42 ++++++++-------- 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/src/WorkFlowCheck.API/Controllers/CheckListController.cs b/src/WorkFlowCheck.API/Controllers/CheckListController.cs index 7d581bf..0ce3848 100644 --- a/src/WorkFlowCheck.API/Controllers/CheckListController.cs +++ b/src/WorkFlowCheck.API/Controllers/CheckListController.cs @@ -12,30 +12,30 @@ namespace WorkFlowCheck.API.Controllers public class CheckListController : ControllerBase { private ICheckListService _checkListService; - public CheckListController(ICheckListService checkListService) - { - _checkListService = checkListService; - } - - [HttpGet("GetDashboardInfo")] - public async Task> GetDashboardInfo() - { - var retVal = new ApiResponseDTO(); - try - { - retVal.Data = await _checkListService.GetDashboardInfoAsync(); - retVal.IsSuccess = true; - } - catch (Exception ex) - { - retVal.IsSuccess = false; - retVal.Errors.Add("A műszerfal adatainak lekérése sikertelen."); - Log.Error(ex, "GetDashboardInfo failed"); - } - return retVal; - } - - [HttpGet("GetCheckListHeader/{id}")] + public CheckListController(ICheckListService checkListService) + { + _checkListService = checkListService; + } + + [HttpGet("GetDashboardInfo")] + public async Task> GetDashboardInfo() + { + var retVal = new ApiResponseDTO(); + try + { + retVal.Data = await _checkListService.GetDashboardInfoAsync(); + retVal.IsSuccess = true; + } + catch (Exception ex) + { + retVal.IsSuccess = false; + retVal.Errors.Add("A műszerfal adatainak lekérése sikertelen."); + Log.Error(ex, "GetDashboardInfo failed"); + } + return retVal; + } + + [HttpGet("GetCheckListHeader/{id}")] public async Task> GetCheckListHeader(int id) { var retVal = new ApiResponseDTO() diff --git a/src/WorkFlowCheck.Web/Middleware/JwtMiddleware.cs b/src/WorkFlowCheck.Web/Middleware/JwtMiddleware.cs index 27752ac..afd928e 100644 --- a/src/WorkFlowCheck.Web/Middleware/JwtMiddleware.cs +++ b/src/WorkFlowCheck.Web/Middleware/JwtMiddleware.cs @@ -19,6 +19,16 @@ namespace WorkFlowCheck.Web.Middleware public async Task Invoke(HttpContext context) { + var pathignore = context.Request.Path; + if (pathignore.StartsWithSegments("/css") || + pathignore.StartsWithSegments("/js") || + pathignore.StartsWithSegments("/lib") || + pathignore.StartsWithSegments("/images") || + pathignore.StartsWithSegments("/favicon.ico")) + { + await _next(context); + return; + } var token = context.Request.Cookies["AuthToken"]; if (!string.IsNullOrEmpty(token) && ValidateToken(token, out var claims)) diff --git a/src/WorkFlowCheck.Web/Services/CheckListService.cs b/src/WorkFlowCheck.Web/Services/CheckListService.cs index 697bdb0..004aa3d 100644 --- a/src/WorkFlowCheck.Web/Services/CheckListService.cs +++ b/src/WorkFlowCheck.Web/Services/CheckListService.cs @@ -13,27 +13,27 @@ namespace WorkFlowCheck.Web.Services { public class CheckListService : BaseService, ICheckListService { - public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor) - { - } - public async Task GetDashboardInfoAsync() - { - var endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetDashboardInfo"; - try - { - var response = await _httpClient.GetFromJsonAsync>(endpoint); - if (response?.IsSuccess == true && response.Data != null) - { - return response.Data; - } - } - catch (Exception ex) - { - Log.Error(ex, "GetDashboardInfoAsync failed"); - } - return new DashboardDTO { GeneratedAt = DateTime.Now }; - } - public async Task>> GetFilteredCheckListHeaderAsync(DataTablesRequest dataTablesRequest) + public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor) + { + } + public async Task GetDashboardInfoAsync() + { + var endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetDashboardInfo"; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response?.IsSuccess == true && response.Data != null) + { + return response.Data; + } + } + catch (Exception ex) + { + Log.Error(ex, "GetDashboardInfoAsync failed"); + } + return new DashboardDTO { GeneratedAt = DateTime.Now }; + } + public async Task>> GetFilteredCheckListHeaderAsync(DataTablesRequest dataTablesRequest) { try {