On ASP. Microsoft's Membershop framework went through the ASP. NET membership to the ASP. NET simple membership, and then to the current ASP. Each change makes the validation framework more adaptable to change and customizable. This article is the beginning of the ASP. Membership's history and some of the new features and design ideas in the ASP. NET identity to share your understanding. Follow-up will further expand the actual use and implementation of the ASP.
One, ASP. NET Membership
The ASP. Membership was introduced in ASP. NET 2.0 in 2005. For the first time, Microsoft has provided a set of membership solutions for Web Forms, including the structure of tables, the basic operations of user, role and other classes, and even a suite of controls (user login login, user registration CreateUserWizard, etc.) And a set of ready-made management pages for configuration. such as
Microsoft has been the advantage, is very stupid, what is ready to use directly, but also brought a negative impact, is poor adaptability, lack of flexibility, can not cope with the actual application of the difference in demand, which is mainly reflected in:
1. The table structure cannot be changed, and ASP. NET membership defines the table for you user,role, but in real development, your user table may require more fields, and this time it is often only possible to create a table that stores user-owned information.
2. The provided control seems convenient, but in fact the chicken ribs. Because of the login control and the membership class, only simple user information input is provided, which can not meet the needs of our project. For example: We want users to register at the same time enter the QQ number, phone number, home address. Then there is no way to use the default way to solve it.
3. The default can only be stored in full SQL Server, and for SQL Server CE, SQL Azure is not supported. The data in membership can be stored in other relational databases through a custom provider, but it is cumbersome to implement for NoSQL databases.
Two, ASP. NET Simple Membership
The ASP. NET simple membership is another improvement, and the goal is to make it easier for you to integrate membership into your existing system. More easily body now, it has less external dependence, less intrusion on the original system.
You can define your own user table and then use the following code to generate the tables that membership work on, and you can seamlessly dock the user tables and simple membership in your system. Simplemembership does not have a mandatory table structure, so you can store user information by defining your own user table that you feel comfortable with. In fact, there are 2 user tables, one is the user table you define, and the other is the user table in simple membership, which contains only information related to membership.
Websecurity.initializedatabaseconnection ("DefaultConnection", "UserProfile", "UserId", "UserName", true);
is simple membership the table generated in the database
But simple membership is essentially just the improvement of the previous generation of membership. As can be seen from the figure below, simple membership is another implementation of membership, which provides a convenient membershipprovider for use.
For this reason, simple membership still cannot get rid of some ills:
Three, the ASP is simple introduction
The identity is a new, independent membership system designed by Microsoft, which serves all ASP.
The identity has the following advantages:
For asp: ASP, Web API, SignalR
User Information Customization
Storage is easy to scale: By default, EF Code first is stored in the database, but it is also very easy to extend to SharePoint, Windows Azure Storage Table Service, NoSQL databases
Can unit test
Role: Role Provider, very easy to create and manage roles
Claims privilege information: claims provides richer content than simple role permission control
Social login: such as Facebook
Support for Windows Azure Active Directory
Support Owin
NuGet Publishing and Installation
The principle of identity and the basic design idea
To understand the identity completely, you need to understand OWINfirst. OWIN can refer to the article Next generation ASP. OWIN (1)
The Owin-based design allows the identity to abstract the membership into two large pieces. A piece is the storage of the data that membership relies on, and the authentication part of the identity.
New Membership Framework ASP.