身份提供商MVC覆盖PasswordSignInAsync,自定义存储提供商 - CRM

时间:2015-06-10 13:04:18

标签: c# asp.net-identity crm

实际上我正在MVC5中建立网站,并且我正在使用.Net Identity。在将我的CustomStorageProvider(只是UserTable)连接到CRM时,我遇到了这个问题: 当我尝试登录时:

var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); // <-- here always FAILURE - different hashes + salt in my CRM

switch (result)
{
    ...
}

PasswordSignInAsync登录用户的电子邮件和密码,但我在CRM中使用不同的哈希并需要编辑这个功能的一些行为,是谁有任何想法,怎么样?谢谢你的回答

1 个答案:

答案 0 :(得分:1)

创建IPasswordHasher的自定义实现。 什么都喜欢  公共类MyCustomPasswordHasher:IPasswordHasher

带有自定义用户类的自定义UserManager,如果您需要: 公共类MyAcessoUserManager:UserManager

所以在MyAcessoUserManager上设置一个设置 this.PasswordHasher = new MyCustomPasswordHasher();

请参阅:http://aspnetguru.com/customize-authentication-to-your-own-set-of-tables-in-asp-net-mvc-5/