I'm trying to upgrade a project to ASP.NET 5 / MVC 6.
The UserManager that came with AspNet.Identity used to have a FindAsync method where I could pass in a username and password. It doesn't seem to be there anymore.
I don't think I need the SigninManager or Authentication as I'm using JWT Bearer Authentication. I just need to check the username and password are valid before I grant an access token,
Simply use UserManager.FindByNameAsync()
to find the user object then check its password:
var user = await _userManager.FindByNameAsync(userName);
if(user!=null && await _userManager.CheckPasswordAsync(user, password))
{
// user is valid do whatever you want
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With