diff --git a/src/TickerQ.Dashboard/Endpoints/DashboardEndpoints.cs b/src/TickerQ.Dashboard/Endpoints/DashboardEndpoints.cs index 5399fb8b..f42aec3e 100644 --- a/src/TickerQ.Dashboard/Endpoints/DashboardEndpoints.cs +++ b/src/TickerQ.Dashboard/Endpoints/DashboardEndpoints.cs @@ -40,6 +40,11 @@ public static void MapDashboardEndpoints(this IEndpoin .WithTags("TickerQ Dashboard") .RequireCors("TickerQ_Dashboard_CORS") .AllowAnonymous(), config); + + WithGroupNameIfSet(endpoints.MapGet("/auth/challenge", (DashboardOptionsBuilder dashboardOptions) => + dashboardOptions.Auth.Mode == AuthMode.Host ? Results.Challenge() : Results.Unauthorized()) + .ExcludeFromDescription() + .AllowAnonymous(), config); var apiGroup = endpoints.MapGroup("/api").WithTags("TickerQ Dashboard").RequireCors("TickerQ_Dashboard_CORS"); WithGroupNameIfSet(apiGroup, config); @@ -247,6 +252,11 @@ private static async Task ValidateAuth(HttpContext context, IAuthServic }, dashboardOptions.DashboardJsonOptions); } + if (dashboardOptions.Auth.Mode == AuthMode.Host) + { + return Results.Challenge(); + } + return Results.Unauthorized(); } diff --git a/src/TickerQ.Dashboard/wwwroot/src/components/common/AuthHeader.vue b/src/TickerQ.Dashboard/wwwroot/src/components/common/AuthHeader.vue index 33849d9e..3b41308c 100644 --- a/src/TickerQ.Dashboard/wwwroot/src/components/common/AuthHeader.vue +++ b/src/TickerQ.Dashboard/wwwroot/src/components/common/AuthHeader.vue @@ -156,7 +156,7 @@ watch(isAuthenticated, (newValue) => {