Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net Identity change Password Hashing method [duplicate]

I'm developing an MVC 5 web application with an existing database. I'm also using ASP.Net Identity for my Authorisation and Authentication but in database passwords are not Hashed using Identitys default password hasher, i need to change it with my own hasher. any idea?

like image 627
webber Avatar asked Jun 05 '16 13:06

webber


1 Answers

After creating UserManager instance, you need to assign the passwordhasher property to your CustomPasswordHasher.

UserManager<ApplicationUser> UserManager = new UserManager<ApplicationUser>(store);
UserManager.PasswordHasher = new CustomPasswordHasher(); 

"CustomPasswordHasher" Class should implement "IPasswordHasher" interface

you can see example here

like image 88
Irakli Gabisonia Avatar answered Oct 11 '22 15:10

Irakli Gabisonia