Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between FormsAuthentication Microst.AspNet.Identity.Owin.SignInManager.to authenticate

The default Project template of ASP.NET MVC comes with a class named Microst.AspNet.Identity.Owin.SignInManager. This class is used to authenticate users

I dont understand why should i use SignInManager instead of using simple FormsAuthentication in an ASP.NET MVC Project. What are the benefits of SignInManager?

Does it authenticate in a different way according to FormsAuthentication? Is it more secure then FormsAuthentication? What can i do else with SignInManager except authentication?

What is the relation between SignInManager and the code below? Does The SignInManager use the settings which are set below?

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
    LoginPath = new PathString("/Account/Login"),
    Provider = new CookieAuthenticationProvider
    {
        // Enables the application to validate the security stamp when the user logs in.
        // This is a security feature which is used when you change a password or add an external login to your account.  
        OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
            validateInterval: TimeSpan.FromMinutes(30),
            regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
    }
}); 
like image 205
MOD Avatar asked Oct 12 '15 15:10

MOD


People also ask

What is Microsoft AspNet identity OWIN?

Microsoft.AspNet.Identity.OWIN. This package contains functionality that is used to plug in OWIN authentication with ASP.NET Identity in ASP.NET applications. This is used when you add sign in functionality to your application and call into OWIN Cookie Authentication middleware to generate a cookie.

What is Microsoft AspNet identity?

ASP.NET Identity is Microsoft's user management library for ASP.NET. It includes functionality such as password hashing, password validation, user storage, and claims management. It usually also comes with some basic authentication, bringing its own cookies and multi-factor authentication to the party.

What is identity authentication in MVC?

Identity in MVC 5 Identity is a secured way of authentication methods in web applications. It is used for identifying the authorized user. Background. There are different ways of creating an Identity in applications, but this article explains how to create it using OWIN in ASP.NET MVC.


1 Answers

MembershipProvider came with FormsAuthentication in ASP.NET 2.

ASP.NET Identity came with SignInManager in ASP.NET 5.

ASP.NET Identity is a new version of MembershipProvider. It offers a lot more features than legacy MembershipProvider.

For example,

  • Two-factor authentication
  • Token-based authentication
  • Easy-to-add custom properties compare to MembershipProvider
  • Get instance of UserManager from the OWIN context

If you do not need all those features, you can stick with FormsAuthentication which can be used without MembershipProvider.

like image 118
Win Avatar answered Sep 28 '22 03:09

Win



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!