Initial import into Gitea
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Management.Data;
|
||||
using Management.Security;
|
||||
using Management.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -19,6 +20,12 @@ builder.Services.AddScoped<SqlService>();
|
||||
builder.Services.AddScoped<ClientContext>();
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
// Registration Function client (typed HttpClient)
|
||||
builder.Services.AddHttpClient<RegistrationClient>();
|
||||
|
||||
// Graph API service — app-only credentials for org tenant user listing
|
||||
builder.Services.AddSingleton<GraphService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Middleware pipeline
|
||||
@@ -47,7 +54,10 @@ app.MapGet("/", () => Results.Ok(new
|
||||
{
|
||||
clients = new[] { "GET/POST /api/admin/clients", "GET/PUT/DELETE /api/admin/clients/{id}" },
|
||||
users = new[] { "GET/POST /api/admin/users", "GET/PUT/DELETE /api/admin/users/{id}" },
|
||||
sessions = new[] { "GET /api/admin/sessions", "POST /api/admin/sessions/{id}/revoke" }
|
||||
sessions = new[] { "GET /api/admin/sessions", "POST /api/admin/sessions/{id}/revoke" },
|
||||
templates = new[] { "GET/POST /api/admin/templates", "GET/PUT/DELETE /api/admin/templates/{id}", "GET /api/admin/templates/categories" },
|
||||
objectives = new[] { "GET/POST /api/admin/objectives", "GET/PUT/DELETE /api/admin/objectives/{id}" },
|
||||
reporting = new[] { "GET /api/admin/reporting/summary", "GET /api/admin/reporting/campaigns", "GET /api/admin/reporting/campaigns/{id}", "GET /api/admin/reporting/insights", "GET /api/admin/reporting/analysis" }
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -55,6 +65,9 @@ app.MapGet("/", () => Results.Ok(new
|
||||
// Authentication middleware
|
||||
app.UseMiddleware<ClientAuthMiddleware>();
|
||||
|
||||
// Activity logging — fires after auth so ClientContext is populated
|
||||
app.UseMiddleware<ActivityLoggingMiddleware>();
|
||||
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user