SignInManager, what is it and how, when to use it?

I am studying the SignInManager class. But the information provided on MSDN is very useless. It tells only what methods and properties exist.

I'm looking for,

1) What is SignInManager? 2) How to use it? 3) And I have my own database containing credentials (username and password)

How can I use SignInmanager and how to use it so that my user database is used to authenticate users?

I am using asp.net MVC 5 and Visual Studio 2015. In my sample project, I have an account controller containing action methods such as

  public async Task<ActionResult> ExternalLoginCallback(string returnUrl)

But I have no idea how to use it, MSDN is completely useless to provide information about this. Any useful links that explain this in detail, because I have no idea what SignInManager is and what it is for.

thanks

+22
source share
1 answer

Disclaimer: I am confused by the model used in the ASP.NET identifier, and I say that this is my understanding of things, which may be inaccurate (I can also state obvious things, so I apologize). Also, I recently played with an Asp.Net Core identity, which is slightly different from what was available for Asp.Net 4, so I can mix things up.

Cookies

ASP.NET cookie: Cookie cookie. cookie . cookie (, FacebookAuthenticationMiddleware, ). , cookie cookie . , .

:

public class SignInManager<TUser, TKey> : IDisposable 
    where TUser : class, IUser<TKey> 
    where TKey : IEquatable<TKey>

, , IUser<TKey>. IdentityUser , , IUser<string>. , int TKey, , , .

SignInManager.SignInAsync cookie - , , - , ( asp.net MVC , 't ).

SignInManager.PasswordSignInAsync, , cookie , .

, , , - - OAuth.

Asp.Net Identity User Login, User - ... , () Login - , User . User Login s.

OAuth, - Asp.Net, ( , VS):

  • ( ), (, -. , Facebook, Facebook, URL- - FacebookAuthenticationMiddleware , Facebook).
  • , .
  • , - Asp.Net.
  • - ChallengeResult, ( AccountController.ExternalLogin), URL- AccountController.ExternalLoginCallback, URL- URL- .
  • ChallengeResult HTTP, -, .
  • - - URL-, ( Facebook it /signin-facebook IIRC).
  • , , -, cookie , URL- 4 ( AccountController.ExternalLoginCallback).
  • AccountController.ExternalLoginCallback cookie cookie . , SignInManager.ExternalSignInAsync: Login. , Cookie ; , , , , Login ( , . VS AccountController.ExternalLoginConfirmation). URL- " " 4.

Asp.Net Identity. , UserManager<TUser, TKey> , , IUserStore<TUser, TKey>, IUserRoleStore<TUser, TKey> ..

+32

All Articles