Identity Provider, MVC,override PasswordSignInAsync, custom storage provider - CRM

2.6k views Asked by At

actually l´m building website in MVC5, and l´m using .Net Identity. While connecting my CustomStorageProvider(just UserTable) to CRM, l´m lagged to this problem: When l trying logged in:

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 logged user with email and password, but l´m using in CRM different hashes and need to edit some behaviour of this function, is anybody getting any idea, how to ? Thanks for answers

1

There are 1 answers

0
Daniel Lim-Apo On

Create an custom implementation of IPasswordHasher. Anything like public class MyCustomPasswordHasher : IPasswordHasher

And an custom UserManager with an custom user class, if you need: public class MyAcessoUserManager : UserManager

So put an setting on your MyAcessoUserManager this.PasswordHasher = new MyCustomPasswordHasher();

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