Introducing ASP.NET Identity – A membership system for ASP.NET applications

Introducing ASP.NET Identity – A membership system for ASP.NET applications

Rate This
  • Comments 51

ASP.NET Identity is the new membership system for building ASP.NET web applications. ASP.NET Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.

[Update] Please visit  ASP.NET Identity for getting the latest information about ASP.NET Identity project and learning more on how to get started and migrate from earlier membership systems.

Features

Following are some of the feature of the ASP.NET Identity system

  • One ASP.NET Identity system
    • ASP.NET Identity can be used with all of the ASP.NET frameworks such as ASP.NET MVC, Web Forms, Web Pages, Web API and SignalR
  • Ease of plugging in profile data about the user
    • When you create new users in your application, it is now easy to add extra information about the user. For eg.. if you wanted to add a Birthdate option for users when they Register an account in your application.
    • ASP.NET Identity uses Entity Framework Code First and it is possible to extend the POCO classes.
  • Persistence control
    • By default the ASP.NET Identity system will store all the user information in a database. ASP.NET Identity uses Entity Framework Code First to implement all of its persistence mechanism.
    • If your application requirements are that this information might be stored in a different storage mechanism such as SharePoint, Azure Table Service, No Sql databases etc. it is now possible to plug in different storage providers.
  • Unit testability
    • ASP.NET Identity makes the web application more unit testable. You can write Unit Tests for the parts of your application that use ASP.NET Identity
  • Simple Role provider
    • There is a Simple Role providers which lets you restrict access to parts of your application by Roles. You can easily create Roles such as “Admin” and add Users to Roles.
  • Claims Based
    • ASP.NET Identity supports claims-based authentication, where the user’s identity is represented as a set of claims. There is a Claims
  • External Logins 
    • You can easily add external logins such as Microsoft Account, Facebook, Twitter and Google to your application store the user specific data in your application using this system.
    • You can also add login functionality using Windows Azure Active Directory and store the user specific data in your application using this system.

How do I get it?

ASP.NET Identity is used by ASP.NET Web Forms, MVC and SPA templates in Visual Studio 2013. it is also available as Nuget packages on the Nuget gallery

  • Nuget packages
    • Microsoft.Aspnet.Identity.Core
      • This package contains the core interfaces of ASP.NET Identity.
      • core
    • Microsoft.Aspnet.Identity.EntityFramework
      • This package contains the implementation of ASP.NET Identity system which works with Entity Framework. This means that if you use this package then you can store information in a Sql Server database.
      • ef 
  • VS 2013 preview
    • The ASP.NET Web Forms, MVC and SPA templates have 1.0.0-alpha1 version of ASP.NET Identity
  • ASP.NET and Web Tools 2013 Preview Refresh (Supports English version of VS2013 Preview only)
    • The ASP.NET Web Forms, MVC and SPA templates have 1.0.0-beta1 version of ASP.NET Identity
    • You can download the Preview refresh by clicking the above link
    • Following are the notable changes from 1.0.0-alpha1 – 1.0.0-beta1
      • In these templates you no longer need IdentityConfig.cs
      • Lots of public APIs were changed for renames and refactoring of code.
      • Transactions support was added to the framework.

 

Sample to add profile data

The following video video(mark 55min) http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/DEV-B314#fbid=fEhPNbmXE9- gives you a sneak peak into the features.

You can download a sample from https://github.com/rustd/AspnetIdentitySample. This is based on the ASP.NET MVC template that shipped with ASP.NET and Web Tools 2013 Preview Refresh (Supports English version of VS2013 Preview only) Once you have this Preview Refresh installed you can do the same for ASP.NET Web Forms and SPA applications.

Please do stay tuned to this blog for upcoming posts where I will dive into the various other features in this system.

Leave a Comment
  • Please add 1 and 6 and type the answer here:
  • Post
  • Cool. Are you going to open source this library? Right after it become final?

  • Hi,

    Seems to be very nice!

    What if I already have a designed Database to manage Users and I am using Database First strategy for EF?

    Can I get it running on my current ASP.Net 4.5(.0) projects?

    thank you very much

    Alberto

  • For those of you, preferring custom membership database schema and database-first development, see:

    github.com/.../MembershipDatabase

  • 1. Can I use old membership database from SimpleMembership (MVC4) with this new membership system?

    2. And what should I do if I have a lot of members in database using SqlMembershipProvider (Old ASP.NET Web Forms) already? can I migrate the data or else to smooth transition process as possible?

    Thank you

  • This looks like a clean and configurable implementation. One thing that I can't figure out (or maybe it's impossible?) is that I have to use a class name other than User (like MyUser or CustomUser) for my user model (because its base class is Microsoft.AspNet.Identity.EntityFramework.User and for some odd reason Entity Framework cannot create database model when both classes share the same simple name). It's not really nice to use MyUser throughout the project.

    Anyway, some documentation would be nice.

  • I'd love to see some other mechanism for plugging in a custom DbContext model. For example:

    var db = new DatabaseContext();

    IdentityStoreManager.RegisterUserStore(context: db, usersStore: db => db.Users, userId: u => u.UserID, userName: u => u.LoginName);

    So that consumers could not only use a custom db context, entity models but also their own property names, which may differ from what is defined in Microsoft.AspNet.Identity.Core

  • this is still does not support the default registration process on a website.

    1. Register with e-mail

    2. Confirm mail account

    3. Login

    Also resending forgotten password is not supported?! How can i add that?

  • @piggy, suthep you should be able to implement custom stores to integrate your existing databases.  We will definitely have more information/blog posts about how to do this for RTM if not sooner.

  • I would also like to see a configuration example. I already have a table named Users I would like to reuse.

  • @daniel, We don't have the email registration/password reset out of box, but a community SPA template shows how to do it really well with WebAPI in VS2012.2, please check www.asp.net/.../backbonejs-template.

  • i was working on something similar to this for our applications needs. It seems that there's something missing with your schema that a lot of users would need (well... i think). I think your schema should be Applications aware. What if i need to have different Roles in each Applications that i have?

    For exemple, all my users are in ActiveDirectory. To gain access to an application, an user must be in a Role of that application.

    Is it possible to do that easly with the new Asp.net Identity? I ask you that because it seems that the SimpleMembershipProvider and your new Asp.net Identity are for one application only.

    alex

  • This is cool. I will have to read more on ONE ASP.NET and this Asp.net Identity. VS 2013 will be so cool

  • I agree with AlexandreJobin.  If this is planned to support only one app then it might be good to state so upfront so we don't waste much time hoping the RTM will be different.

  • it would be great to hear a member of the Asp.Net Identity team about if it will be for single application only or if we will be able to have a strategy per application. It's still the time to think about it before the beta release :)

  • It would be great with example that can reuse my User class that uses Int32 for user id instead of Guid.

    Really missing some documentation for configuration.

    Also will this be open sourced?

Page 1 of 4 (51 items) 1234