Asp.net mvc 如何在node.js中处理ASP.NET标识记录?
我想从ASP.NET MVC Identity迁移到node.js。我的数据库中有以下字段: 密码哈希: AOCB5TrZGusq9ZUdYd/w/u7GUZTPOMG7JhFd4JgS0gLOulL8QjZRbl4T6sPXwD3lfQ== 密码是asdfgak。 我不知道如何使用这个PasswordHash,也不知道如何从node.js向登录用户获取hash和salt 我看到了答案,但毫无帮助,结果如下: A+w9Dyfupc+dMkViA0eYF4ol7HhdIfVPct6o47a+n5M= 以下是我在MVC项目中的代码,如果有帮助的话:Asp.net mvc 如何在node.js中处理ASP.NET标识记录?,asp.net-mvc,node.js,hash,salt,Asp.net Mvc,Node.js,Hash,Salt,我想从ASP.NET MVC Identity迁移到node.js。我的数据库中有以下字段: 密码哈希: AOCB5TrZGusq9ZUdYd/w/u7GUZTPOMG7JhFd4JgS0gLOulL8QjZRbl4T6sPXwD3lfQ== 密码是asdfgak。 我不知道如何使用这个PasswordHash,也不知道如何从node.js向登录用户获取hash和salt 我看到了答案,但毫无帮助,结果如下: A+w9Dyfupc+dMkViA0eYF4ol7HhdIfVPct6o47a+n5M
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();
}
}
公共类应用程序用户:IdentityUser
{
公共异步任务GenerateUserIdentityAsync(用户管理器)
{
var userIdentity=wait manager.CreateIdentityAsync(这是DefaultAuthenticationTypes.ApplicationOkie);
//在此处添加自定义用户声明
返回用户身份;
}
//我的自定义字段,如用户名、性别。。。
}
公共类ApplicationDbContext:IdentityDbContext
{
公共应用程序上下文()
:base(“个人”,throwifvv1schema:false)
{
}
公共静态应用程序上下文创建()
{
返回新的ApplicationDbContext();
}
}
好的,我找到了这个模块,您甚至可以在同步和异步之间进行选择,它非常棒: