Contrib.AspNetCore.Identity.Mongo
8.4.0
dotnet add package Contrib.AspNetCore.Identity.Mongo --version 8.4.0
NuGet\Install-Package Contrib.AspNetCore.Identity.Mongo -Version 8.4.0
<PackageReference Include="Contrib.AspNetCore.Identity.Mongo" Version="8.4.0" />
paket add Contrib.AspNetCore.Identity.Mongo --version 8.4.0
#r "nuget: Contrib.AspNetCore.Identity.Mongo, 8.4.0"
// Install Contrib.AspNetCore.Identity.Mongo as a Cake Addin #addin nuget:?package=Contrib.AspNetCore.Identity.Mongo&version=8.4.0 // Install Contrib.AspNetCore.Identity.Mongo as a Cake Tool #tool nuget:?package=Contrib.AspNetCore.Identity.Mongo&version=8.4.0
âšī¸ Disclaimer
This is a fork of AspNetCore.Identity.Mongo repository. The original repository has not been updated for 2+ years, maintainer seems to be inactive. This fork is created to keep the library up to date with latest .NET Core versions.
AspNetCore.Identity.Mongo
This is a MongoDB provider for the ASP.NET Core Identity framework. It is completely written from scratch and provides support for all Identity framework interfaces:
- IUserClaimStore
- IUserLoginStore
- IUserRoleStore
- IUserPasswordStore
- IUserSecurityStampStore
- IUserEmailStore
- IUserPhoneNumberStore
- IQueryableUserStore
- IUserTwoFactorStore
- IUserLockoutStore
- IUserAuthenticatorKeyStore
- IUserAuthenticationTokenStore
- IUserTwoFactorRecoveryCodeStore
- IProtectedUserStore
- IRoleStore
- IRoleClaimStore
- IQueryableRoleStore
Dot Net Core Versions support
Library supports .Net 8.0, .Net 7.0, .Net 6.0, .Net 5.0, .Net Core 3.1 simultaneously started from 8.3.0 nuget package.
How to use:
AspNetCore.Identity.Mongo is installed from NuGet:
Install-Package AspNetCore.Identity.Mongo
The simplest way to set up:
using AspNetCore.Identity.Mongo;
using AspNetCore.Identity.Mongo.Model;
// At the ConfigureServices section in Startup.cs
services.AddIdentityMongoDbProvider<MongoUser>();
With Identity and Mongo options:
using AspNetCore.Identity.Mongo;
using AspNetCore.Identity.Mongo.Model;
// At the ConfigureServices section in Startup.cs
services.AddIdentityMongoDbProvider<MongoUser>(identity =>
{
identity.Password.RequiredLength = 8;
// other options
} ,
mongo =>
{
mongo.ConnectionString = "mongodb://127.0.0.1:27017/identity";
// other options
});
Using User and Role models:
using AspNetCore.Identity.Mongo;
using AspNetCore.Identity.Mongo.Model;
// At the ConfigureServices section in Startup.cs
services.AddIdentityMongoDbProvider<MongoUser, MongoRole>(identity =>
{
identity.Password.RequiredLength = 8;
// other options
},
mongo =>
{
mongo.ConnectionString = "mongodb://127.0.0.1:27017/identity";
// other options
});
Using different type of the primary key (default is MongoDB.Bson.ObjectId
):
using AspNetCore.Identity.Mongo;
using AspNetCore.Identity.Mongo.Model;
public class ApplicationUser : MongoUser<string>
{
}
public class ApplicationRole : MongoRole<string>
{
}
// At the ConfigureServices section in Startup.cs
services.AddIdentityMongoDbProvider<ApplicationUser, ApplicationRole, string>(identity =>
{
identity.Password.RequiredLength = 8;
// other options
},
mongo =>
{
mongo.ConnectionString = "mongodb://127.0.0.1:27017/identity";
// other options
});
To add the stores only, use:
using AspNetCore.Identity.Mongo;
using AspNetCore.Identity.Mongo.Model;
// At the ConfigureServices section in Startup.cs
services
.AddIdentityCore<MongoUser>()
.AddRoles<MongoRole>()
.AddMongoDbStores<MongoUser, MongoRole, ObjectId>(mongo =>
{
mongo.ConnectionString = "mongodb://127.0.0.1:27017/identity";
// other options
})
.AddDefaultTokenProviders();
Migration from lower versions
New releases could/will have the breaking changes.
Folder docs contains migration guides. E.g.:
There you can find information how to migrate from 6.0.0-6.3.5 to 6.7.x version.<br> There you can find information how to migrate from 3.1.5 to 6.7.x version.
If you have different version of the library and want to update it, please create a new issue. We will try to help you or will create new instruction.
How to Contribute
Before create any issue/PR please look at the CONTRIBUTING
Code of conduct
See CODE_OF_CONDUCT
License
This project is licensed under the MIT license
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 is compatible. 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 is compatible. 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.1 is compatible. |
-
.NETCoreApp 3.1
- MongoDB.Driver (>= 2.23.1)
-
net5.0
- MongoDB.Driver (>= 2.23.1)
-
net6.0
- MongoDB.Driver (>= 2.23.1)
-
net7.0
- MongoDB.Driver (>= 2.23.1)
-
net8.0
- MongoDB.Driver (>= 2.23.1)
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 |
---|---|---|
8.4.0 | 423 | 1/21/2024 |
Removed .net core 2.1 support, added .net 6.0, 7.0, 8.0 support, updated obsolete packages