CouchDB identity store provider for the ASP.NET Core Identity using 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 implementation.
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 😄
By default a database named identity
is used but you can change it using the options overload.
Your CouchDB database must implement the ddoc.json in the ddocs folder.
At your Startup.cs
add your ICouchClient
in DI and use the following code.
using AspNetCore.Identity.CouchDB.Models;
// Configure Identity stores and services.
services.AddIdentity<CouchDbUser, CouchDbRole>()
.AddCouchDbStores();
Or you can provide your own instance of ICouchClient
in the options.
// Configure Identity stores and services.
// With custom client.
services.AddIdentity<CouchDbUser, CouchDbRole>()
.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 fodler.
services.AddIdentity<CouchDbUser, CouchDbRole>()
.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.
The project is Licensed under the MIT License see the LICENSE for more info.