I've created my own PasswordValidator
and add it to the IdentityBuilder by using services.AddIdentity<, >().AddPasswordValidator<>()
.
This adds my PasswordValidator on top of the default one, so the password will be checked by both. (not what I need).
How can I remove the default one?
AddIdentity
only adds the default PasswordValidator
implementation if one hasn't already been registered. Because of this, you can add your custom implementation before calling AddIdentity
:
services.AddScoped<IPasswordValidator<YourUser>, YourPasswordValidator>();
services.AddIdentity<YourUser, YourRole>(...);
In this case, only YourPasswordValidator
gets registered.