Add client to auth logs in api and wasm client (#541)

This commit is contained in:
Leendert de Borst
2025-02-10 11:32:39 +01:00
parent 1ed74874e5
commit e153dc6fe7
14 changed files with 1913 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
using AliasVault.Client;
using AliasVault.Client.Providers;
using AliasVault.RazorComponents.Services;
using AliasVault.Shared.Core;
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
@@ -56,6 +57,10 @@ builder.Services.AddScoped(sp =>
// If API URL override is set (used e.g. in dev), then ensure the API URL ends with a forward slash.
var baseUrl = string.IsNullOrEmpty(apiConfig.ApiUrl) ? builder.HostEnvironment.BaseAddress + "api/" : apiConfig.ApiUrl.TrimEnd('/') + "/";
httpClient.BaseAddress = new Uri(baseUrl);
// Add client header.
httpClient.DefaultRequestHeaders.Add("X-AliasVault-Client", "client-" + AppInfo.GetFullVersion());
return httpClient;
});
builder.Services.AddTransient<AliasVaultApiHandlerService>();