|
1 | 1 |  |
2 | 2 |
|
3 | 3 | # MongoEntityFramework.AspNetCore.Identity |
| 4 | + |
4 | 5 | Asp.Net Core Identity providers for [MongoDB.EntityFrameworkCore](https://github.com/mongodb/mongo-efcore-provider). |
5 | 6 |
|
6 | 7 | ## Features |
| 8 | + |
7 | 9 | MongoFramework Implementations |
| 10 | + |
8 | 11 | - IdentityUser |
9 | 12 | - IdentityRole |
10 | 13 | - RoleStore |
11 | 14 | - UserStore |
12 | 15 | - UserOnlyStore |
13 | 16 |
|
14 | 17 | ServiceCollection Extensions for |
15 | | -- MongoDbContext |
16 | | -````cs |
17 | | -services.AddMongoDbContext<MongoDbContext>(o => |
18 | | - o.ConnectionString = Configuration.GetConnectionString("DefaultConnection")); |
19 | | -```` |
20 | 18 |
|
21 | 19 | - Identity Stores (adds to IdentityBuilder) |
22 | | -````cs |
23 | | -services.AddDefaultIdentity<MongoIdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) |
24 | | - .AddMongoFrameworkStores<MongoDbContext>(); |
25 | | -```` |
26 | | - |
27 | | -- Complete Identity (User Only) |
28 | | -````cs |
29 | | -services.AddMongoDbContext<MongoDbContext>(o => |
30 | | - o.ConnectionString = Configuration.GetConnectionString("DefaultConnection")); |
31 | 20 |
|
32 | | -services.AddDefaultMongoIdentity<MongoIdentityUser, MongoDbContext>(); |
33 | | -```` |
| 21 | +```cs |
| 22 | +builder.Services.AddDefaultIdentity<MongoIdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) |
| 23 | + .AddMongoEntityFrameworkStores<ApplicationDbContext>(); |
| 24 | +``` |
34 | 25 |
|
35 | | -- Complete Identity (Users and Roles) |
36 | | -````cs |
37 | | -services.AddMongoDbContext<MongoDbContext>(o => |
38 | | - o.ConnectionString = Configuration.GetConnectionString("DefaultConnection")); |
39 | | - |
40 | | -services.AddMongoIdentity<MongoIdentityUser, MongoIdentityRole, MongoDbContext>(); |
41 | | -```` |
42 | | - |
43 | | -Sample .NET Core Project |
| 26 | +Sample .NET 9.0 Project shows a fully working example |
44 | 27 |
|
45 | 28 | Unit Tests, including passing Asp.Net Core's IdentitySpecificationBase |
46 | 29 |
|
47 | 30 | ## IdentitySpec Tests |
| 31 | + |
48 | 32 | [This issue](https://github.com/dotnet/aspnetcore/issues/27873) shows the spec tests weren't |
49 | | -publicly released for .NET 5.0. They are supposed to be, but do not show up on NuGet yet. |
| 33 | +publicly released for .NET 5.0. They are supposed to be, but do not show up on NuGet yet. |
50 | 34 | I have added the code manually to the test project until this gets published. |
51 | | - |
0 commit comments