linven / MembershipRebootToAspNetIdentity.PasswordHasher

Example of a password hasher moving from BrockAllen.MembershipReboot to AspNet.Identity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MembershipRebootToAspNetIdentity.PasswordHasher

Example of a password hasher moving from BrockAllen.MembershipReboot to ASP.NET Core Identity

This can be used so that when you migrate from BrockAllen.MembershipReboot to ASP.NET Core Identity ASP.NET Core Identity.

On line 30 in PasswordHasher.cs you need to check that it matches your hash format in the DB. if it does not replace it with the format you use or possibly with pattern matching in case you have used multiple hashes.

To use the custom password hasher, in your UserManager's constructor your want to overwrite the base.PasswordHasher property with a new instance of this custom one. It takes the passwordHasher that was injected in the constructor as an argument. This is because if the password hash is not a MembershipReboot hash it will call the base passwordHasher.

base.PasswordHasher = new PasswordHasher<TUser>(passwordHasher);

And that should be it. Now you should be able to use the backwards compatible password hasher.

When you have confirmed that all your users have changed passwords to the new format this hasher is no longer needed and can be refactored out.

About

Example of a password hasher moving from BrockAllen.MembershipReboot to AspNet.Identity


Languages

Language:C# 100.0%