Visus.HeaderAuthentication
1.0.0-pre
dotnet add package Visus.HeaderAuthentication --version 1.0.0-pre
NuGet\Install-Package Visus.HeaderAuthentication -Version 1.0.0-pre
<PackageReference Include="Visus.HeaderAuthentication" Version="1.0.0-pre" />
paket add Visus.HeaderAuthentication --version 1.0.0-pre
#r "nuget: Visus.HeaderAuthentication, 1.0.0-pre"
// Install Visus.HeaderAuthentication as a Cake Addin #addin nuget:?package=Visus.HeaderAuthentication&version=1.0.0-pre&prerelease // Install Visus.HeaderAuthentication as a Cake Tool #tool nuget:?package=Visus.HeaderAuthentication&version=1.0.0-pre&prerelease
ASP.NET Core HTTP-header authentication middleware
This library implements middleware to add authentication schemes bases on HTTP headers to an ASP.NET Core application.
Usage
In your application setup, add something like this:
builder.Services.AddHeaderAuthentication("MyScheme", o => {
// Note: It is important that the authentication scheme and the
// authentication type passed to the handler are the same.
o.HeaderHandler = new BasicHeaderHandler("MyScheme", new Dictionary<string, string> {
{ "user1", "password1" },
{ "user2", "password2" }
});
});
The HeaderHandler
is an implementation of the Visus.HeaderAuthentication.Handlers.IHeaderHandler
interface which creates claims from the configured header values. The library supplies a handler for the basic authentication scheme and a "Token".
Instead of hard coding the users, you can add callbacks to BasicHeaderHandler
and TokenHeaderHandler
, which allow for lookup of users and tokens in other sources like databases. Setting a custom callback also allows for customising the Sytstem.Security.Claims.Claim
s created for a successfully authenticated user.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Authentication (>= 2.2.0)
- Microsoft.Extensions.Options (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-pre | 82 | 8/22/2024 |