https://github.com/panoukos41/couchdb-identity
CouchDB Storage Provider for ASP.NET Core Identity
https://github.com/panoukos41/couchdb-identity
aspnetcore couchdb csharp dotnet identity
Last synced: 3 months ago
JSON representation
CouchDB Storage Provider for ASP.NET Core Identity
- Host: GitHub
- URL: https://github.com/panoukos41/couchdb-identity
- Owner: panoukos41
- License: mit
- Created: 2021-02-21T18:52:54.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-07T12:42:53.000Z (over 5 years ago)
- Last Synced: 2025-08-01T04:48:52.603Z (12 months ago)
- Topics: aspnetcore, couchdb, csharp, dotnet, identity
- Language: C#
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# AspNetCore.Identity.CouchDB
[](https://github.com/panoukos41/couchdb-identity/actions/workflows/release.yaml)
[](https://www.nuget.org/packages/AspNetCore.Identity.CouchDB)
[](https://github.com/panoukos41/couchdb-identity/blob/main/LICENSE.md)
[CouchDB](https://couchdb.apache.org/) identity store provider for the [ASP.NET Core Identity](https://github.com/dotnet/aspnetcore/tree/main/src/Identity) using [CouchDB.NET](https://github.com/matteobortolazzo/couchdb-net).
The UserStore implements the following Interfaces:
- IQueryableUserStore
- IUserStore
- IUserPasswordStore
- IUserSecurityStampStore
- IUserEmailStore
- IUserPhoneNumberStore
- IUserRoleStore
- IUserClaimStore
- IUserLoginStore
- IUserTwoFactorStore
- IUserAuthenticatorKeyStore
- IUserLockoutStore
The RoleStore implements the following Interfaces:
- IQueryableRoleStore
- IRoleStore
- IRoleClaimStore
The project was insipired from the existing [AspNetCore.Identity.Cassandra](https://github.com/lkubis/AspNetCore.Identity.Cassandra) implementation.
# Before Getting started
This project was made in a hurry and was live tested on a really simple application so some things might not work as expected. Feel free to open an issue and even a pull request.
I will try my best to support the project and provide tests and samples whenever i find time.
Thanks for looking at this library 😄
# Getting Started
By default a database named `identity` is used but you can change it using the options overload.
Your [CouchDB](https://couchdb.apache.org/) database must implement the [ddoc.json](ddocs/ddoc.json) in the [ddocs](/ddocs) folder.
At your `Startup.cs` add your `ICouchClient` in DI and use the following code.
```csharp
using AspNetCore.Identity.CouchDB.Models;
// Configure Identity stores and services.
services.AddIdentity()
.AddCouchDbStores();
```
Or you can provide your own instance of `ICouchClient` in the options.
```csharp
// Configure Identity stores and services.
// With custom client.
services.AddIdentity()
.AddCouchDbStores(options => options
.UseClient(new CouchClient("http://localhost:5984")));
```
You can also customize the `design document` and `views` used by the library. More information as to what a view returns and when can be found in the [ddocs](/ddocs) fodler.
```csharp
services.AddIdentity()
.AddCouchDbStores(options => options
.UseViewOptions(new CouchDbViewOptions
{
Document = "identity";
User = "user";
UserNormalizedUsername = "user.normalized_username";
UserNormalizedEmail = "user.normalized_email";
UserRolesNormalizedName = "user.roles.normalized_name";
UserClaims = "user.claims";
UserLogins = "user.logins";
Role = "role";
RoleNormalizedName = "role.normalized_name";
})));
```
Services are *registered as Singleton* since `ICouchClient` is/should be registered as such and no other dependency is needed.
# LICENSE
The project is Licensed under the MIT License see the [LICENSE](LICENSE.md) for more info.