Bazinga.AspNetCore.Authentication.Basic
2.0.1
dotnet add package Bazinga.AspNetCore.Authentication.Basic --version 2.0.1
NuGet\Install-Package Bazinga.AspNetCore.Authentication.Basic -Version 2.0.1
<PackageReference Include="Bazinga.AspNetCore.Authentication.Basic" Version="2.0.1" />
paket add Bazinga.AspNetCore.Authentication.Basic --version 2.0.1
#r "nuget: Bazinga.AspNetCore.Authentication.Basic, 2.0.1"
// Install Bazinga.AspNetCore.Authentication.Basic as a Cake Addin #addin nuget:?package=Bazinga.AspNetCore.Authentication.Basic&version=2.0.1 // Install Bazinga.AspNetCore.Authentication.Basic as a Cake Tool #tool nuget:?package=Bazinga.AspNetCore.Authentication.Basic&version=2.0.1
Bazinga.AspNetCore.Authentication.Basic
Basic Authentication for Microsoft ASP.NET Core Security
Microsoft doesn't ship a Basic Authentication package with ASP.NET Core Security for a good reason. While that doesn't stop us needing such implementation for testing, this is not advised for production systems due to the many pitfalls and insecurities.
Sample usages, with hard-coded credentials:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddAuthentication()
.AddBasicAuthentication(credentials =>
Task.FromResult(
credentials.username == "myUsername"
&& credentials.password == "myPassword"));
}
Or by defining a service to register. Allowing your validator to take dependencies through Dependency Injection:
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthorization()
.AddBasicAuthentication<DatabaseBasicCredentialVerifier>();
}
// With your own validator
public class DatabaseBasicCredentialVerifier : IBasicCredentialVerifier
{
private readonly IUserRepository _db;
public DatabaseBasicCredentialVerifier(IUserRepository db) => _db = db;
public Task<bool> Authenticate(string username, string password)
{
return _db.IsValidAsync(username, password);
}
}
And finally, since ASP.NET Core 2.0, the single middeware for authentication:
public void Configure(IApplicationBuilder app)
{
app.UseAuthentication();
app.AddMvc();
}
For better understanding of the ASP.NET Core Identity, see Microsoft docs
License
Licensed under MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Authentication (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection (>= 2.0.0)
- Microsoft.Extensions.Options (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Bazinga.AspNetCore.Authentication.Basic:
Repository | Stars |
---|---|
mehdihadeli/food-delivery-microservices
🍔 A practical and imaginary food delivery microservices, built with .Net 8, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
alaatm/Sejil
Capture, view and filter your ASP.net core log events right from your app
|
Bugfix: Unhandled exception logs the inner exception