Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Identity login

I have a website in MVC 5 using ASP.NET Identity to login a user. Everything works great.

Now my partner needs to login a registered user in his WinForms app. Does anyone know the password hashing algorythm used by Identity or how can I authenticate the user in the WinForms app?

Any tips would be apreciated.

Best regards.

like image 299
hpinhal Avatar asked Jan 06 '14 14:01

hpinhal


People also ask

Is ASP.NET identity free?

IdentityServer is a free, open source OpenID Connect and OAuth 2.0 framework for ASP.NET Core.

What is ASP.NET Core identity?

ASP.NET Core Identity: Is an API that supports user interface (UI) login functionality. Manages users, passwords, profile data, roles, claims, tokens, email confirmation, and more.

How does ASP.NET identity work?

ASP.NET Core Identity is a membership system which allows you to add login functionality to your application. Users can create an account and login with a user name and password or they can use an external login providers such as Facebook, Google, Microsoft Account, Twitter and more.

Is ASP.NET Core identity secure?

ASP.NET Core provides many tools and libraries to secure ASP.NET Core apps such as built-in identity providers and third-party identity services such as Facebook, Twitter, and LinkedIn.


1 Answers

If you are using Microsoft.AspNet.Identity.EntityFramework from the MVC app and the WinForm app has access to the same database, then you should configure it to use the same ConnectionString as the MVC application. Add Microsoft.AspNet.Identity.EntityFramework to the WinForm application using nuget.

Then the following code can be used to verify username and password:

public async Task<bool> VerifyUserNamePassword(string userName, string password)
{
   var usermanager = new UserManager<IdentityUser>(new UserStore<IdentityUser>(new IdentityDbContext()));
   return await usermanager.FindAsync(userName, password) != null;
}
like image 142
Olav Nybø Avatar answered Oct 12 '22 01:10

Olav Nybø