Reusable LX collection extensions methods for instantiating http client message handlers
$ dotnet add package LeverX.AuthorizationLX.Authorization is a library designed to handle authorization in .NET applications. It provides a flexible and extensible way to manage tokens, user permissionsm and roles.
You can install the LX.Authorization library via NuGet Package Manager:
dotnet add package LX.Authorization --version 0.0.3
In your Startup.cs or Program.cs, add the following code to configure the authorization services:
using LX.Authorization;
...
builder.Services.CreateCustomMessageHandler(builder.Configuration, [ "Api"]);
builder.Services.RegisterLXServices(builder.Configuration, new[]
{
(typeof(IDumpHttpClient), typeof(DumpHttpClient), "Api"),
});
builder.Services.CreateCustomAccountFactory(builder.Configuration, "Local");
...
await builder.Build().RunAsync();
As for the second parameter of CreateCustomMessageHandler and CreateCustomAccountFactory
you should add some values to the appsettings.json file, it should contain the following configuration:
{
"Local": {
"Authority": "",
"ClientId": ""
},
"Api": ""
}