MongoFlow.Identity 1.0.0-beta.7

This is a prerelease version of MongoFlow.Identity.
dotnet add package MongoFlow.Identity --version 1.0.0-beta.7
                    
NuGet\Install-Package MongoFlow.Identity -Version 1.0.0-beta.7
                    
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="MongoFlow.Identity" Version="1.0.0-beta.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MongoFlow.Identity" Version="1.0.0-beta.7" />
                    
Directory.Packages.props
<PackageReference Include="MongoFlow.Identity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MongoFlow.Identity --version 1.0.0-beta.7
                    
#r "nuget: MongoFlow.Identity, 1.0.0-beta.7"
                    
#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.
#:package MongoFlow.Identity@1.0.0-beta.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MongoFlow.Identity&version=1.0.0-beta.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MongoFlow.Identity&version=1.0.0-beta.7&prerelease
                    
Install as a Cake Tool

MongoFlow.Identity

License: MIT NuGet

A MongoDB provider for ASP.NET Core Identity, built on MongoFlow. Users and roles are stored in a MongoFlow vault, so its query filters, features and interceptors apply to them like to any other collection. It ships with MongoFlow, at the same version.

Installation

dotnet add package MongoFlow.Identity --prerelease

Usage

Derive the app's vault from IdentityMongoVault, register it, and call AddMongoFlowStores after AddRoles:

public sealed class AppVault : IdentityMongoVault;

services.AddMongoVault<AppVault>(vault => vault.UseDatabase("app"));

services.AddIdentityCore<MongoUser>()
    .AddRoles<MongoRole>()
    .AddMongoFlowStores<AppVault>();

The vault has three collections, Users, Roles and UserTokens, named after their properties unless the vault's configuration names them. A user is one document, with its claims, logins, role ids and passkeys inside; tokens are documents of their own.

Your own users, roles or keys

public sealed class AppUser : MongoUser
{
    public string? DisplayName { get; set; }
}

public sealed class AppRole : MongoRole
{
    public string? Description { get; set; }
}

public sealed class AppVault : IdentityMongoVault<AppUser, AppRole, ObjectId>;

IdentityMongoVault<TUser> and IdentityMongoVault<TUser, TKey> cover the cases with plain roles. The driver fills in a missing ObjectId when a user, role or token is created. With string keys, set users' and roles' ids yourself; tokens, which the store creates, get an ObjectId string. With another key type, set the ids yourself, and register an id generator for it with BsonSerializer.RegisterIdGenerator for tokens.

Switching a feature off

The managers AddMongoFlowStores registers can make a copy whose reads and writes have a vault feature switched off, such as to reach every tenant's users, or deleted ones:

var allTenants = userManager.Without(MultiTenancyFeature.Key);
var user = await allTenants.FindByEmailAsync(email);

var deletedRoles = roleManager.Without(SoftDeleteFeature.Key);

They take the place of Identity's own managers. A manager of the app's own, registered with AddUserManager or AddRoleManager, is kept instead, and can't switch features off.

Concurrency

Updates and deletes of users and roles apply only while the stored ConcurrencyStamp is the one read, and an update renews it, as Identity's Entity Framework store does: one made after another request changed the user fails with ConcurrencyFailure, rather than overwriting the other's change. So does one made while another request's transaction is changing the same user or role, which MongoDB rejects as a write conflict. Deleting a user deletes its tokens too.

More

  • MongoFlow's docs: the vault, its configuration, features and interceptors, which apply to Identity's collections like to any other.
  • The changelog: what changed since 0.2.
  • The samples keep accounts in an Identity vault that soft-deletes users, and restore one through Without(SoftDeleteFeature.Key).
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
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-beta.7 33 10/6/2026
1.0.0-beta.6 38 10/6/2026
1.0.0-beta.5 45 10/4/2026
1.0.0-beta.4 48 10/3/2026
1.0.0-beta.3 46 10/3/2026
1.0.0-beta.2 45 10/3/2026
1.0.0-beta.1 53 10/2/2026
0.2.8 4,672 1/10/2026
0.2.7 286 1/5/2026
0.2.6 198 12/26/2025
0.2.5 222 12/26/2025
0.2.4 224 12/25/2025
0.2.3 224 12/25/2025
0.2.2 711 9/27/2025
0.2.1 2,150 3/16/2025
0.2.0 697 1/12/2025
0.2.0-beta.0 235 12/19/2024
0.1.16 240 12/17/2024
0.1.15 306 12/2/2024
0.1.14 196 12/1/2024
Loading failed