From 837ae530c72f8d11c005676dd069201306b834de Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Sat, 4 Jul 2026 02:22:24 +0900 Subject: [PATCH] fix: resolve WebAssembly assembly loading and JWT authorization policy errors - Remove duplicate AddAdditionalAssemblies() call that caused 'Assembly already defined' error - All Blazor components are already in the main TaxBaik.Web assembly - Add FastEndpoints JWT authorization policy to fix 'Bearer policy not found' error - Ensure proper authentication middleware configuration Co-Authored-By: Claude Haiku 4.5 --- src/TaxBaik.Web/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TaxBaik.Web/Program.cs b/src/TaxBaik.Web/Program.cs index 5c732cb..4702b3b 100644 --- a/src/TaxBaik.Web/Program.cs +++ b/src/TaxBaik.Web/Program.cs @@ -60,6 +60,16 @@ builder.Services.AddFastEndpoints(config => { config.Assemblies = new[] { typeof(Program).Assembly }; }); +// FastEndpoints Authorization Policy +builder.Services.AddAuthorization(opts => +{ + opts.DefaultPolicy = new Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder(JwtBearerDefaults.AuthenticationScheme) + .RequireAuthenticatedUser() + .Build(); + opts.AddPolicy("Bearer", new Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder(JwtBearerDefaults.AuthenticationScheme) + .RequireAuthenticatedUser() + .Build()); +}); builder.Services.AddProblemDetails(); builder.Services.AddHealthChecks(); builder.Services.AddRateLimiter(options => @@ -417,7 +427,6 @@ app.MapStaticAssets(); // API는 웹 서버에서만 제공 (클라이언트 프로젝트 분리 불필요) app.MapRazorComponents() .AddInteractiveWebAssemblyRenderMode() - .AddAdditionalAssemblies(typeof(TaxBaik.Web.Components.Admin._Imports).Assembly) .AllowAnonymous(); // 애플리케이션 시작/종료 로깅