我们正在为.net核心api项目实施Identityserver身份验证。我已经实现了IdentityServer基础结构,该基础结构创建了AspNetUsers,AspNetUserRoles等表。用户被插入aspnetusers表中。我想使用我们的成员表而不是aspnetusers表。我该怎么办?
public class ApplicationUser : IdentityUser
{
[Required]
[MaxLength(200)]
public String Name { get; set; }
}
[HttpPost]
[Route("token")]
public async Task<IActionResult> CreateToken([FromBody] LoginModel loginModel)
{
if (ModelState.IsValid)
{
var loginResult = await signInManager.PasswordSignInAsync(loginModel.Username, loginModel.Password, isPersistent: false, lockoutOnFailure: false);
if (!loginResult.Succeeded)
{
return BadRequest();
}
var user = await userManager.FindByNameAsync(loginModel.Username);
Login();
return Ok(GetToken(user));
}
return BadRequest(ModelState);
}