Dr. Roggia
Dr. Roggia

Reputation: 1125

Implement ASP.Net Core identity PasswordHash on Full framework Project

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.

Upvotes: 2

Views: 3914

Answers (2)

AlbertK
AlbertK

Reputation: 13167

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.

Upvotes: 1

Ayoub Codes.
Ayoub Codes.

Reputation: 988


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

Upvotes: 0

Related Questions