ASP.NET Identity RavenDb Provider
| Aguacongas.Identity.RavenDb |
|---|
You setup RavenDb stores using one AddRavenDbStores extension method
You can setup RavenDb stores using the current IDocumentStore:
services.AddSingleton(p => new DocumentStore
{
Urls = new[] { "https://a.ravendb.local" },
Database = "Identity"
}.SetFindIdentityPropertyForIdentityModel() // REQUIRED, Identity model identifiers are not computed by the database but the store
.Initialize());
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddRavenDbStores(); Or with a Func<IServiceProvider, IDocumentStore> creating the IDocumentStore :
var documentStore = new DocumentStore
{
Urls = new[] { "https://a.ravendb.local" },
Database = "Identity"
}.SetFindIdentityPropertyForIdentityModel() // REQUIRED, Identity model identifiers are not computed by the database but the store
.Initialize();
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddRavenDbStores(p => documentStore);Both methods can take a string dataBase parameter to specify the RavenDb database to use:
services.AddIdentity<IdentityUser, IdentityRole>()
.AddRedisStores(dataBase: "Identity")
.AddDefaultTokenProviders();Your user and role class must be
IdentityUserandIdentityRoleor derived.
The IdentitySample is a dotnet webapp with individual authentication using a RavenDb database.
This library is tested using Microsoft.AspNetCore.Identity.Specification.Tests, the shared test suite for Asp.Net Identity Core store implementations.