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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has answers here:
Closed 3 years ago.
回答1:
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