我想从 ASP.NET MVC Identity 迁移到 node.js。我的数据库中有以下字段:
PasswordHash: AOCB5TrZGusq9ZUdYd/w/u7GUZTPOMG7JhFd4JgS0gLOulL8QjZRbl4T6sPXwD3lfQ==
密码是 asdfgak。 我不知道如何使用此 PasswordHash 以及如何从中获取哈希和盐以从 node.js 登录用户。
我看到了this回答但它根本没有帮助,输出如下:
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();
}
}
最佳答案
好的,我发现了这个模块,你甚至可以在同步和异步之间进行选择,这太棒了:
关于asp.net-mvc - 如何处理 node.js 中的 ASP.NET 身份记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30269487/