2

I saw some posts on the internet talking about the difference between the hashig system of an ASP.Net core and full framework project. Now, i'm trying to use an Identity accounting with acounts made with ASP.Net core Identity and i can't log in using the Full framework application, because the password hashing is different. I know from this article that you can use both hashing on Core, but i didn't find anything about Framework, which i need. My question is: how can i implement the same Password Hasher from ASP.Net Core in my Full Framework application? Is there a way out? Even a common PasswordHashing system for both application could work. Thanks in advance.

2
  • 1
    I think you want overwrite hashing algorithm of FullFramework, is it true? Commented Apr 12, 2018 at 8:01
  • @isaeid Yes, i'm trying to override the hashing algorithm on FullFramework to get the same hashed password from a Core application Commented Apr 12, 2018 at 8:04

2 Answers 2

1

It looks like you need to implement Microsoft.AspNet.Identity.IPasswordHasher according to AspNet Core implementation:

public class AspNetCorePasswordHasher : IPasswordHasher
{  
   ... 
}

Then you need to say ApplicationUserManager to use your PasswordHasher:

public class ApplicationUserManager : UserManager<ApplicationUser>
{
    public ApplicationUserManager(IUserStore<ApplicationUser> store)
        : base(store)
    {
        PasswordHasher = new AspNetCorePasswordHasher();
    }
    ...
}

I'm not sure that you can just copy an implementation, but since AspNet core is open source I think you will be able repeat the implementation.

Sign up to request clarification or add additional context in comments.

1 Comment

Since PasswordHasher is a IPasswordHasher<TUser> type, couldn't we simply remove it from the service collection and register a new implementation in the Startup.ConfigureServices() method?
0


you can use HashPassword method's
try to see this :
https://msdn.microsoft.com/en-us/library/microsoft.aspnet.identity.passwordhasher(v=vs.108).aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.