Added authorization to controllers, added environment check to swagger, added authorization to health checks

This commit is contained in:
2025-10-05 02:11:52 +02:00
parent d9f3c67e8a
commit 2931c55509
5 changed files with 15 additions and 3 deletions

View File

@@ -53,8 +53,11 @@ if (!app.Environment.IsDevelopment())
}
app.UseElmah();
app.UseSwagger();
app.UseSwaggerUI();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseStaticFiles();
app.UseRouting();
@@ -71,7 +74,8 @@ app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapHealthChecks("/healthz");
app.MapHealthChecks("/healthz")
.RequireAuthorization();
// Run migrations
using var scope = app.Services.CreateScope();