我想从ASP.NET MVC身份转移到node.js。我的数据库中有以下字段:
密码哈希:AOCB5TrZGusq9ZUdYd / w / u7GUZTPOMG7JhFd4JgS0gLOulL8QjZRbl4T6sPXwD3lfQ ==
密码为asdfgak。我不知道如何使用此PasswordHash以及如何从中获取哈希和盐以从node.js登录用户。
我看到了这个答案,但是它根本没有帮助,它的输出如下:
A + w9Dyfupc + dMkViA0eYF4ol7HhdIfVPct6o47a + n5M =
这是我在MVC项目中拥有的代码,如果有帮助的话:
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
// my custom fields like username, gender...
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("Personal", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
好的,我发现了这个模块,您甚至可以在同步和异步之间进行选择,它很棒:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句