Rework Admin UI #6

Merged
MasterMito merged 18 commits from epic/admin_rework_second_try into main 2026-03-20 11:55:38 +01:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 26d7d83811 - Show all commits
@@ -22,10 +22,11 @@ public class TenantValidationMiddleware
return; return;
} }
// Exempt bootstrap, admin, and debug endpoints from tenant validation // Exempt bootstrap, admin, debug, and Keycloak OIDC endpoints from tenant validation
if (context.Request.Path.StartsWithSegments("/api/clubs/me") || if (context.Request.Path.StartsWithSegments("/api/clubs/me") ||
context.Request.Path.StartsWithSegments("/api/admin") || context.Request.Path.StartsWithSegments("/api/admin") ||
context.Request.Path.StartsWithSegments("/api/debug")) context.Request.Path.StartsWithSegments("/api/debug") ||
context.Request.Path.StartsWithSegments("/realms"))
{ {
_logger.LogInformation("TenantValidationMiddleware: Exempting {Path} from tenant validation", context.Request.Path); _logger.LogInformation("TenantValidationMiddleware: Exempting {Path} from tenant validation", context.Request.Path);
await _next(context); await _next(context);
+4 -1
View File
@@ -147,9 +147,12 @@ app.UseHttpsRedirection();
app.UseCors("AllowFrontend"); app.UseCors("AllowFrontend");
// IMPORTANT: Order matters!
// 1. Authentication must come before tenant validation so JWT middleware can fetch JWKS
// 2. Tenant validation should come after auth but before endpoints
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<TenantValidationMiddleware>(); app.UseMiddleware<TenantValidationMiddleware>();
app.UseAuthorization();
app.UseMiddleware<MemberSyncMiddleware>(); app.UseMiddleware<MemberSyncMiddleware>();
app.MapHealthChecks("/health/live", new Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckOptions app.MapHealthChecks("/health/live", new Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckOptions