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.
-
1I think you want overwrite hashing algorithm of FullFramework, is it true?isaeid– isaeid2018-04-12 08:01:42 +00:00Commented 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 applicationDr. Roggia– Dr. Roggia2018-04-12 08:04:19 +00:00Commented Apr 12, 2018 at 8:04
Add a comment
|
2 Answers
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.
1 Comment
micka190
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?
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