Added authenication/authorization. Refactored api startup.
Some checks failed
ci / build-test (push) Has been cancelled
ci / publish-image (push) Has been cancelled

This commit is contained in:
2026-02-16 00:20:02 -05:00
parent a85989a337
commit 9f30ef446a
25 changed files with 685 additions and 154 deletions

View File

@@ -14,7 +14,31 @@ string apiBase = builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.
Console.WriteLine(apiBase);
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBase) });
// Old way
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBase) });
// Register the handler
builder.Services.AddTransient<IncludeRequestCredentialsMessageHandler>();
//builder.Services.AddSingleton<TokenStore>();
//builder.Services.AddTransient<JwtAuthorizationMessageHandler>();
// Register a named client that uses the handler
builder.Services.AddHttpClient("Api", client =>
{
client.BaseAddress = new Uri(apiBase);
})
.AddHttpMessageHandler<IncludeRequestCredentialsMessageHandler>();
//.AddHttpMessageHandler<JwtAuthorizationMessageHandler>();
// Keep your existing pattern (inject HttpClient) by mapping it to the named client
builder.Services.AddScoped(sp =>
sp.GetRequiredService<IHttpClientFactory>().CreateClient("Api")
);
builder.Services.AddScoped<AuthenticationClient>();
builder.Services.AddScoped<SessionState>();
builder.Services.AddMudServices();
builder.Services.AddRadzenComponents();
builder.Services.AddBitBlazorUIServices();