ASP.Net Identity change Password Hashing method [duplicate]

☆樱花仙子☆ 提交于 2019-12-22 09:48:18

问题


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?


回答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



来源:https://stackoverflow.com/questions/37642684/asp-net-identity-change-password-hashing-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!