Skip to content

JohnCampionJr/MongoFramework.AspNetCore.Identity

Repository files navigation

Actions Status Codacy Badge codecov

MongoFramework.AspNetCore.Identity

.Net Core Identity providers for MongoFramework.

Features

MongoFramework Implementations

  • IdentityUser
  • IdentityRole
  • RoleStore
  • UserStore
  • UserOnlyStore

ServiceCollection Extensions for

  • MongoDbContext
services.AddMongoDbContext<MongoDbContext>(o =>
    o.ConnectionString = Configuration.GetConnectionString("DefaultConnection"));
  • Identity Stores (adds to IdentityBuilder)
services.AddDefaultIdentity<MongoIdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddMongoFrameworkStores<MongoDbContext>();
  • Complete Identity (User Only)
services.AddMongoDbContext<MongoDbContext>(o =>
    o.ConnectionString = Configuration.GetConnectionString("DefaultConnection"));

services.AddDefaultMongoIdentity<MongoIdentityUser, MongoDbContext>();
  • Complete Identity (Users and Roles)
services.AddMongoDbContext<MongoDbContext>(o =>
    o.ConnectionString = Configuration.GetConnectionString("DefaultConnection"));

services.AddMongoIdentity<MongoIdentityUser, MongoIdentityRole, MongoDbContext>();

Sample .NET Core Project

Unit Tests, including passing Asp.Net Core's IdentitySpecificationBase

IdentitySpec Tests

This issue shows the spec tests weren't publicly released for .NET 5.0. They are supposed to be, but do not show up on NuGet yet. I have added the code manually to the test project until this gets published.