Benday.Identity.CosmosDb
1.1.0
See the version list below for details.
dotnet add package Benday.Identity.CosmosDb --version 1.1.0
NuGet\Install-Package Benday.Identity.CosmosDb -Version 1.1.0
<PackageReference Include="Benday.Identity.CosmosDb" Version="1.1.0" />
<PackageVersion Include="Benday.Identity.CosmosDb" Version="1.1.0" />
<PackageReference Include="Benday.Identity.CosmosDb" />
paket add Benday.Identity.CosmosDb --version 1.1.0
#r "nuget: Benday.Identity.CosmosDb, 1.1.0"
#:package Benday.Identity.CosmosDb@1.1.0
#addin nuget:?package=Benday.Identity.CosmosDb&version=1.1.0
#tool nuget:?package=Benday.Identity.CosmosDb&version=1.1.0
Benday.Identity.CosmosDb
ASP.NET Core Identity implementation using Azure Cosmos DB as the backing store. Built on top of the Benday.CosmosDb repository pattern library.
Features
- Full ASP.NET Core Identity support with Cosmos DB storage
- User management (create, update, delete, find)
- Role-based access control
- Claims-based authorization
- Account lockout protection
- Two-factor authentication (2FA) support
- External login providers (Google, Facebook, Microsoft, etc.)
- Phone number verification
- Security stamp management for token invalidation
- LINQ query support
Installation
dotnet add package Benday.Identity.CosmosDb
Dependencies
- Benday.CosmosDb - Cosmos DB repository pattern library
- Microsoft.Extensions.Identity.Core
Implemented Interfaces
User Store (CosmosDbUserStore)
IUserStore<IdentityUser>IUserPasswordStore<IdentityUser>IUserEmailStore<IdentityUser>IUserRoleStore<IdentityUser>IUserSecurityStampStore<IdentityUser>IUserLockoutStore<IdentityUser>IUserClaimStore<IdentityUser>IUserTwoFactorStore<IdentityUser>IUserPhoneNumberStore<IdentityUser>IUserAuthenticatorKeyStore<IdentityUser>IUserTwoFactorRecoveryCodeStore<IdentityUser>IUserLoginStore<IdentityUser>IQueryableUserStore<IdentityUser>
Role Store (CosmosDbRoleStore)
IRoleStore<IdentityRole>IRoleClaimStore<IdentityRole>IQueryableRoleStore<IdentityRole>
Claims Principal Factory
DefaultUserClaimsPrincipalFactory- A default implementation that adds role claims to the identity. Override this class to customize claims generation for your application.
Usage
Register the identity stores in your Program.cs or startup configuration:
using Benday.Identity.CosmosDb;
using Benday.CosmosDb.Utilities;
// Configure Cosmos DB
var cosmosConfig = new CosmosConfigBuilder()
.UseLocalEmulator()
.WithDatabase("YourDatabase")
.Build();
// Register Cosmos client
services.AddSingleton(sp =>
{
var options = CosmosClientOptionsUtilities.GetCosmosClientOptions(cosmosConfig);
return new CosmosClient(cosmosConfig.ConnectionString, options);
});
// Register User Store
services.Configure<CosmosRepositoryOptions<IdentityUser>>(options =>
{
options.DatabaseName = cosmosConfig.DatabaseName;
options.ContainerName = "Users";
options.PartitionKeyPath = "/ownerId";
});
services.AddScoped<IUserStore<IdentityUser>, CosmosDbUserStore>();
services.AddScoped<ICosmosDbUserStore, CosmosDbUserStore>();
// Register Role Store
services.Configure<CosmosRepositoryOptions<IdentityRole>>(options =>
{
options.DatabaseName = cosmosConfig.DatabaseName;
options.ContainerName = "Roles";
options.PartitionKeyPath = "/ownerId";
});
services.AddScoped<IRoleStore<IdentityRole>, CosmosDbRoleStore>();
// Register Identity with default claims principal factory
services.AddIdentity<IdentityUser, IdentityRole>()
.AddDefaultTokenProviders();
services.AddScoped<IUserClaimsPrincipalFactory<IdentityUser>, DefaultUserClaimsPrincipalFactory>();
Domain Models
IdentityUser
The user entity with support for:
- Username and email (with automatic normalization)
- Password hash
- Security stamp and concurrency stamp
- Phone number with confirmation
- Two-factor authentication (authenticator key, recovery codes)
- Account lockout
- Claims collection
- External login providers
IdentityRole
The role entity with support for:
- Role name (with automatic normalization)
- Concurrency stamp
- Claims collection
Partition Key Strategy
All identity entities use a "SYSTEM" partition key by default, meaning all users and roles are stored in the same logical partition. This simplifies queries and works well for most applications. If you need a different partitioning strategy, you can override the SystemOwnedItem base class.
License
MIT License - see LICENSE file for details.
| 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. net10.0 was computed. 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. |
| .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. |
-
.NETStandard 2.1
- Benday.CosmosDb (>= 5.2.0)
- Microsoft.Extensions.Identity.Core (>= 9.0.12)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Benday.Identity.CosmosDb:
| Package | Downloads |
|---|---|
|
Benday.Identity.CosmosDb.UI
ASP.NET Core Identity UI for Azure Cosmos DB. Provides pre-built Login/Logout/AccessDenied Razor Pages, a RedirectToLogin Blazor component, and AddCosmosIdentityWithUI() convenience method that combines core identity registration with cookie authentication. Built on top of Benday.Identity.CosmosDb. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.10 | 126 | 5/10/2026 |
| 6.0.9-alpha | 103 | 4/27/2026 |
| 6.0.8-alpha | 104 | 4/20/2026 |
| 6.0.7-alpha | 103 | 4/20/2026 |
| 6.0.2-alpha | 110 | 4/4/2026 |
| 6.0.1-alpha | 120 | 4/3/2026 |
| 6.0.0-alpha | 116 | 3/25/2026 |
| 3.2.0 | 167 | 3/13/2026 |
| 3.1.2 | 164 | 3/10/2026 |
| 3.1.1 | 160 | 3/10/2026 |
| 3.1.0 | 126 | 3/9/2026 |
| 3.0.0 | 125 | 2/27/2026 |
| 2.1.0 | 146 | 2/9/2026 |
| 2.0.0 | 144 | 2/5/2026 |
| 1.1.0 | 115 | 2/4/2026 |
| 1.0.0-alpha | 480 | 12/9/2025 |
v1.1.0 - Update dependencies and package metadata; Changing target framework to netstandard2.1; Removing alpha tag
v1.0.0 - Initial release with full ASP.NET Core Identity store implementations for Cosmos DB