Visus.HeaderAuthentication 1.0.0-pre

This is a prerelease version of Visus.HeaderAuthentication.
dotnet add package Visus.HeaderAuthentication --version 1.0.0-pre                
NuGet\Install-Package Visus.HeaderAuthentication -Version 1.0.0-pre                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Visus.HeaderAuthentication" Version="1.0.0-pre" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Visus.HeaderAuthentication --version 1.0.0-pre                
#r "nuget: Visus.HeaderAuthentication, 1.0.0-pre"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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.Claims created for a successfully authenticated user.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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