Proxima.SelfEdu.Scaffolding.BasicAuth
1.0.2
See the version list below for details.
dotnet add package Proxima.SelfEdu.Scaffolding.BasicAuth --version 1.0.2
NuGet\Install-Package Proxima.SelfEdu.Scaffolding.BasicAuth -Version 1.0.2
<PackageReference Include="Proxima.SelfEdu.Scaffolding.BasicAuth" Version="1.0.2" />
paket add Proxima.SelfEdu.Scaffolding.BasicAuth --version 1.0.2
#r "nuget: Proxima.SelfEdu.Scaffolding.BasicAuth, 1.0.2"
// Install Proxima.SelfEdu.Scaffolding.BasicAuth as a Cake Addin #addin nuget:?package=Proxima.SelfEdu.Scaffolding.BasicAuth&version=1.0.2 // Install Proxima.SelfEdu.Scaffolding.BasicAuth as a Cake Tool #tool nuget:?package=Proxima.SelfEdu.Scaffolding.BasicAuth&version=1.0.2
Proxima.SelfEdu.Scaffolding.BasicAuth
Handy project for quickly adding HTTP Basic Authentication to Asp.Net Core projects. Used for self-education purposes and experiments. Available on Nuget.
Usage
Simplest way to enable basic authentication is to have configuration section in your appsettings.json
"BasicAuthentication": {
"Realm": "localhost",
"Username": "admin",
"Password": "your secret password here"
}
Of course, you could use alternative configuration sources, such as environment variables, which is especially convenient for docker compose scenarios.
After that, you can add necessary services:
builder.Services.AddBasicAuthFromOptions<BasicAuthenticationOptions>("BasicAuthentication");
Note that you remain in control of config section path (provided as a string parameter), as well as actual *Options object structure, as long as you can inherit from BasicAuthenticationOptions.
For more flexibility, you can use .AddBasicAuth()
extension:
builder.Services.AddBasicAuth(options =>
{
options.Realm = "localhost";
options.Username = "admin";
options.Password = "your secret password here";
});
If you want to modify created AuthenticationTicket
, for example to add custom claims into ClaimsPrincipal
,
override AuthenticationTicketFactory
delegate.
At the moment, there is no way to override used auth schema name (BasicAuthScheme
).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.