User1520731567 posted
Hi FarhatKhan,
First you can create a separate class CustomPasswordValidator which is inherited from IIdentityValidator<string>.
You can then implement validation logic in ValidateAsync(T) method.
There you will retrieve rules from DB and check them against the passed string argument.
Then I suppose you are using a kind of ApplicationUserManager class derived from UserManager.
Add a constructor parameter of IIdentityValidator<string> type to ApplicationUserManager, assign it to PasswordValidator property.
ApplicationUserManager instance created with CustomPasswordValidator instance as an argument will validate you passwords against DB rules.
Refer to this
source of UserManager to see when exactly PasswordValidator property is called.
You could also refer to this link:
https://devblogs.microsoft.com/aspnet/implementing-custom-password-policy-using-asp-net-identity/
Best Regards.
Yuki Tao