LiteDB.Identity 1.0.8

dotnet add package LiteDB.Identity --version 1.0.8
NuGet\Install-Package LiteDB.Identity -Version 1.0.8
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="LiteDB.Identity" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiteDB.Identity --version 1.0.8
#r "nuget: LiteDB.Identity, 1.0.8"
#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 LiteDB.Identity as a Cake Addin
#addin nuget:?package=LiteDB.Identity&version=1.0.8

// Install LiteDB.Identity as a Cake Tool
#tool nuget:?package=LiteDB.Identity&version=1.0.8

LiteDB.Identity

πŸš€ Start a seamless authentication experience with LiteDB.Identity πŸš€

The revolutionary implementation of ASP.NET Core Identity tailored for the LiteDB database engine. LiteDB.Identity will provide quick creation of login, registration, roles, claims, and token functionality for web applications.

πŸ’‘This isn't just a tool - it's your passport to an efficient authentication experience. πŸ’‘

Latest versions supports:

  • LiteDB 5.0.17
  • .NET 8
  • .NETSTANDARD 2.1
  • Microsoft.Extensions.Identity.Core 8.0.0
  • Microsoft.Extensions.Identity.Stores 8.0.0

Support

If you have found my contributions to the projects helpful, consider buying me a coffee to fuel my efforts πŸ˜ƒ

How to use it ?

Please install latest version of LiteDB.Identity using NuGet:

Install-Package LiteDB.Identity

For ASP.NET Core 8:

Install-Package LiteDB.Identity -Version 1.0.8

For ASP.NET Core 7:

Install-Package LiteDB.Identity -Version 1.0.7

For ASP.NET Core 6:

Install-Package LiteDB.Identity -Version 1.0.6

For ASP.NET Core 3.1:

Install-Package LiteDB.Identity -Version 1.0.3

Next, in your Startup.cs file add reference to namespace:

using LiteDB.Identity.Extensions;

Add default LiteDb.Identity implementation in Program.cs file:

For ASP.NET Core 8 :

using Microsoft.AspNetCore.Identity;
using LiteDB.Identity.Extensions;
using LiteDB.Identity.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddLiteDBIdentity(connectionString);
builder.Services.AddDefaultIdentity<LiteDbUser>();

builder.Services.AddControllersWithViews();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    //app.UseMigrationsEndPoint();
}
else
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();

app.Run();

For ASP.NET Core 6 and 7 :

using LiteDB.Identity.Extensions;
using Microsoft.AspNetCore.Identity;

var builder = WebApplication.CreateBuilder(args);

// Add Identity services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddLiteDBIdentity(connectionString).AddDefaultTokenProviders().AddDefaultUI();
//...
builder.Services.AddControllersWithViews();

var app = builder.Build();
//...
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
app.Run();

For ASP.NET Core 3.1:

        public void ConfigureServices(IServiceCollection services)
        {

            string connectionString = Configuration.GetConnectionString("IdentityLiteDB");
            services.AddLiteDBIdentity(connectionString).AddDefaultTokenProviders().AddDefaultUI();

            services.AddControllersWithViews();
            services.AddRazorPages();
        }

NOTE: appsettings.json should contains connection string to your LiteDB file. For more implementation details please refer to sample project.

Stores implementation

Following interfaces has been implemented on :

  • UserStore :
    public class UserStore<TUser, TRole, TUserRole, TUserClaim, TUserLogin, TUserToken> : 
                                    IUserLoginStore<TUser>, 
                                    IUserStore<TUser>,
                                    IUserRoleStore<TUser>,
                                    IUserClaimStore<TUser>, 
                                    IUserPasswordStore<TUser>, 
                                    IUserSecurityStampStore<TUser>, 
                                    IUserEmailStore<TUser>, 
                                    IUserLockoutStore<TUser>, 
                                    IUserPhoneNumberStore<TUser>, 
                                    IQueryableUserStore<TUser>, 
                                    IUserTwoFactorStore<TUser>,
                                    IUserAuthenticationTokenStore<TUser>,
                                    IUserAuthenticatorKeyStore<TUser>,
                                    IUserTwoFactorRecoveryCodeStore<TUser>
  • RoleStore :
    public class RoleStore<TRole, TRoleClaim> : IQueryableRoleStore<TRole>, 
                                                IRoleStore<TRole>, 
                                                IRoleClaimStore<TRole>

Where to use it ?

  • Great for small and medium size website application based on:
    • ASP.NET Core MVC,
    • Blazor Server,
    • ASP.NET Core WebPages,
  • Quick implementation of Authentication and Authorization mechanism for WebAPIs.

References

License

MIT

Product 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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LiteDB.Identity:

Package Downloads
LiteDB.Identity.Async

Uses the LiteDB.Identity and combines it with LiteDB.async

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.8 296 12/15/2023
1.0.7 1,971 2/7/2023
1.0.6 279 2/6/2023
1.0.3 2,323 5/26/2020