Introduce IdentityCore.Adapter.AspNetMembership
Karim Fahmy
Posted on January 11, 2023
IdentityCore.Adapter.AspNetMembership
Is a Adapter library that enables you to use Microsoft Identity with existing code base using AspNetMembership user management
to have several new features like Two-Factor Authentication, Account Lockout, Account Confirmation, Password Reset, Security Stamp (Sign-Out Everywhere) and external login with existing Facebook, Google, Twitter or Live login.
Before, these features had to be coded,
so now developers can focus more on main business while using tested and standardized method to manage users.
Required
.Net 6 Framework
Installation
Install by Nuget
dotnet add package IdentityCore.Adapter.AspNetMembership
Usage
if you are using the default schema of AspNetMemberShip without any customization
as well you can include identity options.
services.AddIdentityAdapter(SqlConnectionString);
//or
services.AddIdentityAdapter(SqlConnection, opts =>
{
opts.Password.RequiredLength = 8;
opts.Password.RequireNonAlphanumeric = true;
opts.Password.RequireLowercase = false;
opts.Password.RequireUppercase = true;
opts.Password.RequireDigit = true;
});
if you are using the customize schema of AspNetMemberShip create your own CustomUserStore.cs
and CustomRoleStore.cs
to adapted your customization
services.AddIdentityAdapter(SqlConnection, opts =>
{
opts.Password.RequiredLength = 8;
opts.Password.RequireNonAlphanumeric = true;
opts.Password.RequireLowercase = false;
opts.Password.RequireUppercase = true;
opts.Password.RequireDigit = true;
}).AddUserStore<CustomUserStore>()
.AddRoleStore<CustomRoleStore>();
🔗 Links
Posted on January 11, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.