BetterRedisIdentity 1.0.0.1
See the version list below for details.
dotnet add package BetterRedisIdentity --version 1.0.0.1
NuGet\Install-Package BetterRedisIdentity -Version 1.0.0.1
<PackageReference Include="BetterRedisIdentity" Version="1.0.0.1" />
paket add BetterRedisIdentity --version 1.0.0.1
#r "nuget: BetterRedisIdentity, 1.0.0.1"
// Install BetterRedisIdentity as a Cake Addin #addin nuget:?package=BetterRedisIdentity&version=1.0.0.1 // Install BetterRedisIdentity as a Cake Tool #tool nuget:?package=BetterRedisIdentity&version=1.0.0.1
Better Redis Identity
While there are currently several projects available to connect and interface with Redis, I have found that they are not fully implemented/lack support or have critical bugs that make them unreliable.
🧐 Features
- All user and role stores are implemented.
- Built upon AsyncRedisDocuments (https://github.com/BrylyMaeder/AsyncRedisDocuments)
- Works out of the box
🛠️ Install Dependencies
nuget install BetterRedisIdentity
This will only work for a Redis Database that has Redis Search activated.
Important Information
Please review AsyncRedisDocuments to ensure you're familiar with how the ApplicationUser and ApplicationRole is expected to work. They are both IAsyncDocuments.
The following security information has moved from the user class to the user Security class, which can be accessed in the following manner:
await User.Security.Document.Roles.GetAsync();
- LockoutEnabled
- AccessFailedCount
- LockoutEnd
- PasswordHash
- Claims
- Logins
- Roles
- SecurityStamp
- TwoFactorEnabled
- AuthenticatorKey
- AuthenticatorTokens
- AuthenticatorRecoveryCodes
🧑🏻💻 Setup and Installation
First and and most importantly; initialize your redis singleton.
RedisSingleton.Initialize("host", port, "password");
Make sure your ApplicationUser
enherits from RedisIdentityUser
and your ApplicationRole inherits from RedisIdentityRole
public class ApplicationUser : RedisIdentityUser
public class ApplicationRole : RedisIdentityRole
Next up, add your stores.
builder.Services.AddRedisIdentityStores<ApplicationUser, ApplicationRole>();
If you need to use a custom user manager for your project, please ensure that you enherit from
RedisUserManager<TUser>
Our manager is necessary and is automatically included with AddRedisIdentityStores()
Setup your identity how you like.
builder.Services.AddIdentity<ApplicationUser, ApplicationRole>(options =>
{
options.SignIn.RequireConfirmedAccount = false;
options.User.RequireUniqueEmail = true;
}).AddDefaultTokenProviders()
.AddSignInManager();
Everything else forwards is pretty standard, include your authentication scheme and you should be all set.
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = IdentityConstants.BearerScheme;
options.DefaultSignInScheme = IdentityConstants.BearerScheme;
}).AddBearerToken();
Author
Bryly Maeder
- Github: https://github.com/BrylyMaeder
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- AsyncRedisDocuments (>= 1.0.0.3)
- Microsoft.AspNetCore.Identity (>= 2.3.0)
- Microsoft.Extensions.Identity.Core (>= 9.0.1)
- Microsoft.Extensions.Identity.Stores (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.