ASP.Net身份更改密码哈希方法 [英] ASP.Net Identity change Password Hashing method

查看:80
本文介绍了ASP.Net身份更改密码哈希方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用现有数据库开发MVC 5 Web应用程序. 我也使用ASP.Net Identity进行授权和身份验证,但是在数据库中使用Identitys默认密码哈希器时密码没有散列,我需要使用自己的哈希器进行更改.任何的想法?

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?

推荐答案

创建UserManager实例后,需要将passwordhasher属性分配给CustomPasswordHasher.

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"类应实现"IPasswordHasher"接口

"CustomPasswordHasher" Class should implement "IPasswordHasher" interface

您可以在此处 a>

这篇关于ASP.Net身份更改密码哈希方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆