g0t4 / aspnet-identity-mongo

A mongodb provider for the new ASP.NET Identity framework.
MIT License
197 stars 130 forks source link

## Microsoft.AspNetCore.Identity.MongoDB

This is a MongoDB provider for the ASP.NET Core Identity framework. This was ported from the v2 Identity framework that was a part of ASP.NET (AspNet.Identity.Mongo NuGet package)

I've released a new package for the ASP.NET Core Identity framework for the following reasons:

This project has extensive test coverage.

If you want something easy to setup, this adapter is for you. I do not intend to cover every possible desirable configuration, if you don't like my decisions, write your own adapter. Use this as a learning tool to make your own adapter. These adapters are not complicated, but trying to make them configurable would become a complicated mess. And would confuse the majority of people that want something simple to use. So I'm favoring simplicity over making every last person happy.

Usage

services.AddIdentityWithMongoStores("mongodb://localhost/myDB");
var userManager = provider.GetService<UserManager<IdentityUser>>();
var roleManager = provider.GetService<RoleManager<IdentityRole>>();
    IndexChecks.EnsureUniqueIndexOnNormalizedUserName(users);
    IndexChecks.EnsureUniqueIndexOnNormalizedEmail(users);
    IndexChecks.EnsureUniqueIndexOnNormalizedRoleName(roles);

What frameworks are targeted, with rationale:

Building instructions

run commands in

Migrating from ASP.NET Identity 2.0