I only added the async wrapper and adapted everything to it.
Now you can simply use the async functions.
Nuget
Add default LiteDb.Identity.Async implementation in ConfigureServices method:
public void ConfigureServices(IServiceCollection services)
{
string connectionString = Configuration.GetConnectionString("IdentityLiteDB");
services.AddLiteDbIdentityAsync(connectionString).AddDefaultTokenProviders().AddDefaultUI();
services.AddControllersWithViews();
services.AddRazorPages();
}
Usage of Database:
ILiteDbIdentityAsyncContext _liteDb;
await _liteDb.LiteDatabaseAsync.GetCollection<Map>("Map")
.FindOneAsync(x => x.Id == id);
Usage of Authorize
[Authorize]
[Authorize(Roles = "Admin")]
Following interfaces has been implemented on :
- UserStore :
public class UserStoreAsync<TUser, TRole, TUserRole, TUserClaim, TUserLogin, TUserToken> :
IUserLoginStore<TUser>,
IUserStore<TUser>,
IUserRoleStore<TUser>,
IUserClaimStore<TUser>,
IUserPasswordStore<TUser>,
IUserSecurityStampStore<TUser>,
IUserEmailStore<TUser>,
IUserLockoutStore<TUser>,
IUserPhoneNumberStore<TUser>,
IQueryableUserStore<TUser>,
IUserTwoFactorStore<TUser>,
IUserAuthenticationTokenStore<TUser>,
IUserAuthenticatorKeyStore<TUser>,
IUserTwoFactorRecoveryCodeStore<TUser>
- RoleStore :
public class RoleStoreAsync<TRole, TRoleClaim> : IQueryableRoleStore<TRole>,
IRoleStore<TRole>,
IRoleClaimStore<TRole>
You will find more examples in the repo:
ps. currently only on the TestBranch.
Feel free to support my work by donating:
For business inquiries please use:
- LiteDB.Identity - https://github.com/quicksln/LiteDB.Identity#
- Async Wrapper - https://github.com/mlockett42/litedb-asyncc#
- LiteDB - https://www.litedb.org/
- LiteDB Github - https://github.com/mbdavid/LiteDB
- AspNetCore Identity - Introduction
- AspNetCore Github - https://github.com/dotnet/aspnetcore/tree/master/src/Identity
- Great for small and medium size AspNetCore Websites,
- Quick implementation of Authentication and Authorization mechanism for WebAPIs.