https://github.com/aguafrommars/identity.ravendb
ASP.Net Identity RavenDb provider
https://github.com/aguafrommars/identity.ravendb
asp-net-core identity ravendb
Last synced: 6 months ago
JSON representation
ASP.Net Identity RavenDb provider
- Host: GitHub
- URL: https://github.com/aguafrommars/identity.ravendb
- Owner: Aguafrommars
- License: apache-2.0
- Created: 2021-02-12T10:13:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T02:30:11.000Z (over 1 year ago)
- Last Synced: 2024-05-23T03:32:06.812Z (over 1 year ago)
- Topics: asp-net-core, identity, ravendb
- Language: C#
- Homepage:
- Size: 957 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Identity.RavenDb
[ASP.NET Identity](https://github.com/aspnet/AspNetCore/tree/master/src/Identity) RavenDb Provider[](https://ci.appveyor.com/project/aguacongas/identity-ravendb)
[](https://sonarcloud.io/dashboard?id=Aguafrommars_Identity.RavenDb)Nuget packages
--------------
|Aguacongas.Identity.RavenDb|
|:------:|
|[![][Aguacongas.Identity.RavenDb-badge]][Aguacongas.Identity.RavenDb-nuget]|
|[![][Aguacongas.Identity.RavenDb-downloadbadge]][Aguacongas.Identity.RavenDb-nuget]|[Aguacongas.Identity.RavenDb-badge]: https://img.shields.io/nuget/v/Aguacongas.Identity.RavenDb.svg
[Aguacongas.Identity.RavenDb-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.Identity.RavenDb.svg
[Aguacongas.Identity.RavenDb-nuget]: https://www.nuget.org/packages/Aguacongas.Identity.RavenDb/## Setup
You setup RavenDb stores using one `AddRavenDbStores` extension method
You can setup RavenDb stores using the current IDocumentStore:
```cs
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(options => options.SignIn.RequireConfirmedAccount = true)
.AddRavenDbStores();
```Or with a `Func` creating the `IDocumentStore` :
```cs
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(options => options.SignIn.RequireConfirmedAccount = true)
.AddRavenDbStores(p => documentStore);
```Both methods can take a `string dataBase` parameter to specify the RavenDb database to use:
```cs
services.AddIdentity()
.AddRedisStores(dataBase: "Identity")
.AddDefaultTokenProviders();
```> Your user and role class must be `IdentityUser` and `IdentityRole` or derived.
## Sample
The [IdentitySample](samples/IdentitySample) is a dotnet webapp with individual authentication using a RavenDb database.
## Tests
This library is tested using [Microsoft.AspNetCore.Identity.Specification.Tests](https://www.nuget.org/packages/Microsoft.AspNetCore.Identity.Specification.Tests/), the shared test suite for Asp.Net Identity Core store implementations.