{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Docs/pulls/comments/40708941","id":40708941,"diff_hunk":"@@ -0,0 +1,100 @@\n+Introduction to ASP.NET Identity\n+================================\n+\n+By `Pranav Rastogi <http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity#author-37788>`_, `Rick Anderson <http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity#author-20106>`_, `Tom Dykstra <http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity#author-36250>`_ and `Jon Galloway <http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity#author-5506f>`_\n+\n+The ASP.NET membership system was introduced with ASP.NET 2.0 back in 2005, and since then there have been many changes in the ways web applications typically handle authentication and authorization. ASP.NET Identity is a membership system that is used for building modern applications for the web, phone, or tablet.\n+\n+Getting started with ASP.NET Identity\n+-------------------------------------\n+ \n+ASP.NET Identity is used in the Visual Studio project templates for ASP.NET `MVC <http://www.asp.net/mvc>`_, `Web Forms <http://www.asp.net/web-forms>`_, `Web API <http://www.asp.net/web-api>`_ and `SPA <http://www.asp.net/single-page-application>`_. In this walkthrough, we'll illustrate how the ASP.NET 5 project templates use ASP.NET Identity to add functionality to register, log in and log out a user. \n+\n+The purpose of this article is to give you a high level overview of ASP.NET Identity; you can follow it step by step or just read the details. For more detailed instructions about creating apps using ASP.NET Identity, see the Next Steps section at the end of this article.\n+\n+1. Create an ASP.NET MVC application with Individual Accounts. You can use ASP.NET Identity in an ASP.NET MVC application, as well as other ASP.NET frameworks, such as Web Forms, Web API, SignalR, etc. In this article, you will start with an ASP.NET MVC application. In Visual Studio, select **File** -> **New** -> **Project**. Then, select the **ASP.NET Web Appication** from the **New Project** dialog box. Continue by selecting a **Web Appication** with **Individual User Accounts** as the authenication method.\n+\n+\t.. image:: introduction-to-aspnet-identity/_static/01-mvc.png\n+\t\n+2. The created project contains the following ASP.NET Identity package.\n+\n+- ``Microsoft.AspNet.Identity.EntityFramework``\n+ The `Microsoft.AspNet.Identity.EntityFramework <http://www.nuget.org/packages/Microsoft.AspNet.Identity.EntityFramework/>`_ package has the Entity Framework implementation of ASP.NET Identity which will persist the ASP.NET Identity data and schema to SQL Server. \n+\n+.. note:: In Visual Studio, you can view NuGet packages details by selecting **Tools** -> **NuGet Package Manager** -> **Manage NuGet Packages for Solution**.\n+ \n+3. Creating a user.\n+\n+ Launch the application from Visual Studio (**Debug** -> **Start Debugging**) and then click on the **Register** link in the browser to create a user. The following image shows the *Register* page which collects the user name and password.\n+\n+\t.. image:: introduction-to-aspnet-identity/_static/02-reg.png\n+\n+When the user clicks the **Register** button, the ``Register`` action of the ``AccountController`` creates the user by calling ``CreateAsync`` function of the ``UserManager`` object, as shown below:\n+\n+.. literalinclude:: introduction-to-aspnet-identity/sample/src/ASPNET-IdentityDemo/Controllers/AccountController.cs\n+\t:language: c#\n+\t:lines: 101-127\n+\t:emphasize-lines: 4,10\n+\t:dedent: 8\n+\t\n+4. Log in.\n+ If the user was successfully created, they are logged in by the ``SignInAsync`` method, also contained in the ``Register`` action.\n+\t\n+.. literalinclude:: introduction-to-aspnet-identity/sample/src/ASPNET-IdentityDemo/Controllers/AccountController.cs\n+\t:language: c#\n+\t:lines: 101-127\n+\t:emphasize-lines: 19\n+\t:dedent: 8\n+\n+The above ``SignInAsync`` method calls the below ``SignInAsync`` task, which is contained in the ``SignInManager`` class. The ``SignInAsync`` method is overloaded. The ``authenticationProperties`` parameter that can be added to the call. This parameter is a dictionary used to store state values about the authentication session. These values are applied to the login and authentication cookie. \n+\n+5. Log off.\n+ Clicking the **Log off** link calls the ``LogOff`` action in the account controller. \n+ \n+.. literalinclude:: introduction-to-aspnet-identity/sample/src/ASPNET-IdentityDemo/Controllers/AccountController.cs\n+\t:language: c#\n+\t:lines: 131-138\n+\t:emphasize-lines: 5\n+\t:dedent: 8 \n+ \n+The code above shows the ``SignInManager.SignOut`` method. This is analogous to `FormsAuthentication.SignOut <http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.aspx>`_ method used by the `FormsAuthentication <http://msdn.microsoft.com/en-us/library/system.web.security.formsauthenticationmodule.aspx>`_ module in Web Forms.\n+\n+6. View the database.\n+ After stopping the application, view the user database from Visual Studio by selecting **View** -> **SQL Server Object Explorer**. Then, expand the following within the **SQL Server Object Explorer**:\n+ \n+ - (localdb)\\MSSQLLocalDB\n+ - Databases\n+ - aspnet5-<*the name of your application*>\n+ - Tables\n+\n+ Next, right-click the **dbo.AspNetUsers** table and select **View Data** to see the properties of the user you created.\n+\n+\t.. image:: introduction-to-aspnet-identity/_static/04-db.png\n+\n+Components of ASP.NET Identity\n+------------------------------\n+\n+The diagram below shows the components of the ASP.NET Identity system (click on `this <http://i1.asp.net/media/4459023/1.png?cdn_id=2015-08-15-002>`_ or on the diagram to enlarge it). The packages in green make up the ASP.NET Identity system. All the other packages are dependencies which are needed to use the ASP.NET Identity system in ASP.NET applications.  \n+ \n+\t.. image:: introduction-to-aspnet-identity/_static/03-1Small.png\n+ \n+The following is a brief description of the NuGet packages not mentioned previously:\n+\n+- ``Microsoft.AspNet.Authentication.Cookies``\n+ Middleware that enables an application to use cookie based authentication, similar to ASP.NET's Forms Authentication.","path":"aspnet/security/introduction-to-aspnet-identity.rst","position":84,"original_position":84,"commit_id":"00462592bcdcf0389c9f0a808e5b54f184427972","original_commit_id":"00462592bcdcf0389c9f0a808e5b54f184427972","user":{"login":"MikeWasson","id":3992422,"avatar_url":"https://avatars.githubusercontent.com/u/3992422?v=3","gravatar_id":"","url":"https://api.github.com/users/MikeWasson","html_url":"https://github.com/MikeWasson","followers_url":"https://api.github.com/users/MikeWasson/followers","following_url":"https://api.github.com/users/MikeWasson/following{/other_user}","gists_url":"https://api.github.com/users/MikeWasson/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeWasson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeWasson/subscriptions","organizations_url":"https://api.github.com/users/MikeWasson/orgs","repos_url":"https://api.github.com/users/MikeWasson/repos","events_url":"https://api.github.com/users/MikeWasson/events{/privacy}","received_events_url":"https://api.github.com/users/MikeWasson/received_events","type":"User","site_admin":false},"body":"Specifically the part of forms auth where the user credentials are stored in a cookie and then validated in subsequent requests. (So, not the actually \"forms\" part of forms auth.) ","created_at":"2015-09-29T18:25:59Z","updated_at":"2015-09-29T18:25:59Z","html_url":"https://github.com/aspnet/Docs/pull/470#discussion_r40708941","pull_request_url":"https://api.github.com/repos/aspnet/Docs/pulls/470","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/comments/40708941"},"html":{"href":"https://github.com/aspnet/Docs/pull/470#discussion_r40708941"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/470"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Docs/pulls/470","id":46216427,"html_url":"https://github.com/aspnet/Docs/pull/470","diff_url":"https://github.com/aspnet/Docs/pull/470.diff","patch_url":"https://github.com/aspnet/Docs/pull/470.patch","issue_url":"https://api.github.com/repos/aspnet/Docs/issues/470","number":470,"state":"open","locked":false,"title":"Adding new topic -  introduction-to-aspnet-identity.","user":{"login":"Erikre","id":7407729,"avatar_url":"https://avatars.githubusercontent.com/u/7407729?v=3","gravatar_id":"","url":"https://api.github.com/users/Erikre","html_url":"https://github.com/Erikre","followers_url":"https://api.github.com/users/Erikre/followers","following_url":"https://api.github.com/users/Erikre/following{/other_user}","gists_url":"https://api.github.com/users/Erikre/gists{/gist_id}","starred_url":"https://api.github.com/users/Erikre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Erikre/subscriptions","organizations_url":"https://api.github.com/users/Erikre/orgs","repos_url":"https://api.github.com/users/Erikre/repos","events_url":"https://api.github.com/users/Erikre/events{/privacy}","received_events_url":"https://api.github.com/users/Erikre/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-28T22:30:11Z","updated_at":"2015-09-29T18:25:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a4a4160a75ebb5e8a550ceebac4923a91e1047d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Docs/pulls/470/commits","review_comments_url":"https://api.github.com/repos/aspnet/Docs/pulls/470/comments","review_comment_url":"https://api.github.com/repos/aspnet/Docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Docs/issues/470/comments","statuses_url":"https://api.github.com/repos/aspnet/Docs/statuses/00462592bcdcf0389c9f0a808e5b54f184427972","head":{"label":"Erikre:erikre091515-asp5","ref":"erikre091515-asp5","sha":"00462592bcdcf0389c9f0a808e5b54f184427972","user":{"login":"Erikre","id":7407729,"avatar_url":"https://avatars.githubusercontent.com/u/7407729?v=3","gravatar_id":"","url":"https://api.github.com/users/Erikre","html_url":"https://github.com/Erikre","followers_url":"https://api.github.com/users/Erikre/followers","following_url":"https://api.github.com/users/Erikre/following{/other_user}","gists_url":"https://api.github.com/users/Erikre/gists{/gist_id}","starred_url":"https://api.github.com/users/Erikre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Erikre/subscriptions","organizations_url":"https://api.github.com/users/Erikre/orgs","repos_url":"https://api.github.com/users/Erikre/repos","events_url":"https://api.github.com/users/Erikre/events{/privacy}","received_events_url":"https://api.github.com/users/Erikre/received_events","type":"User","site_admin":false},"repo":{"id":34420782,"name":"Docs","full_name":"Erikre/Docs","owner":{"login":"Erikre","id":7407729,"avatar_url":"https://avatars.githubusercontent.com/u/7407729?v=3","gravatar_id":"","url":"https://api.github.com/users/Erikre","html_url":"https://github.com/Erikre","followers_url":"https://api.github.com/users/Erikre/followers","following_url":"https://api.github.com/users/Erikre/following{/other_user}","gists_url":"https://api.github.com/users/Erikre/gists{/gist_id}","starred_url":"https://api.github.com/users/Erikre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Erikre/subscriptions","organizations_url":"https://api.github.com/users/Erikre/orgs","repos_url":"https://api.github.com/users/Erikre/repos","events_url":"https://api.github.com/users/Erikre/events{/privacy}","received_events_url":"https://api.github.com/users/Erikre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Erikre/Docs","description":"Documentation for ASP.NET 5","fork":true,"url":"https://api.github.com/repos/Erikre/Docs","forks_url":"https://api.github.com/repos/Erikre/Docs/forks","keys_url":"https://api.github.com/repos/Erikre/Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Erikre/Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Erikre/Docs/teams","hooks_url":"https://api.github.com/repos/Erikre/Docs/hooks","issue_events_url":"https://api.github.com/repos/Erikre/Docs/issues/events{/number}","events_url":"https://api.github.com/repos/Erikre/Docs/events","assignees_url":"https://api.github.com/repos/Erikre/Docs/assignees{/user}","branches_url":"https://api.github.com/repos/Erikre/Docs/branches{/branch}","tags_url":"https://api.github.com/repos/Erikre/Docs/tags","blobs_url":"https://api.github.com/repos/Erikre/Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Erikre/Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Erikre/Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Erikre/Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Erikre/Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/Erikre/Docs/languages","stargazers_url":"https://api.github.com/repos/Erikre/Docs/stargazers","contributors_url":"https://api.github.com/repos/Erikre/Docs/contributors","subscribers_url":"https://api.github.com/repos/Erikre/Docs/subscribers","subscription_url":"https://api.github.com/repos/Erikre/Docs/subscription","commits_url":"https://api.github.com/repos/Erikre/Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Erikre/Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Erikre/Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Erikre/Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Erikre/Docs/contents/{+path}","compare_url":"https://api.github.com/repos/Erikre/Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Erikre/Docs/merges","archive_url":"https://api.github.com/repos/Erikre/Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Erikre/Docs/downloads","issues_url":"https://api.github.com/repos/Erikre/Docs/issues{/number}","pulls_url":"https://api.github.com/repos/Erikre/Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/Erikre/Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/Erikre/Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Erikre/Docs/labels{/name}","releases_url":"https://api.github.com/repos/Erikre/Docs/releases{/id}","created_at":"2015-04-22T23:01:10Z","updated_at":"2015-08-26T20:56:02Z","pushed_at":"2015-09-28T22:27:19Z","git_url":"git://github.com/Erikre/Docs.git","ssh_url":"git@github.com:Erikre/Docs.git","clone_url":"https://github.com/Erikre/Docs.git","svn_url":"https://github.com/Erikre/Docs","homepage":null,"size":18812,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aspnet:master","ref":"master","sha":"f47f3d9b680dad7adb73bea88e741c5285444f33","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":28239455,"name":"Docs","full_name":"aspnet/Docs","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Docs","description":"Documentation for ASP.NET 5","fork":false,"url":"https://api.github.com/repos/aspnet/Docs","forks_url":"https://api.github.com/repos/aspnet/Docs/forks","keys_url":"https://api.github.com/repos/aspnet/Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Docs/teams","hooks_url":"https://api.github.com/repos/aspnet/Docs/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Docs/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Docs/events","assignees_url":"https://api.github.com/repos/aspnet/Docs/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Docs/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Docs/tags","blobs_url":"https://api.github.com/repos/aspnet/Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Docs/languages","stargazers_url":"https://api.github.com/repos/aspnet/Docs/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Docs/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Docs/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Docs/subscription","commits_url":"https://api.github.com/repos/aspnet/Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Docs/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Docs/merges","archive_url":"https://api.github.com/repos/aspnet/Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Docs/downloads","issues_url":"https://api.github.com/repos/aspnet/Docs/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Docs/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Docs/releases{/id}","created_at":"2014-12-19T17:38:02Z","updated_at":"2015-09-28T19:38:53Z","pushed_at":"2015-09-29T17:56:35Z","git_url":"git://github.com/aspnet/Docs.git","ssh_url":"git@github.com:aspnet/Docs.git","clone_url":"https://github.com/aspnet/Docs.git","svn_url":"https://github.com/aspnet/Docs","homepage":null,"size":30044,"stargazers_count":197,"watchers_count":197,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":215,"mirror_url":null,"open_issues_count":161,"forks":215,"open_issues":161,"watchers":197,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/470"},"html":{"href":"https://github.com/aspnet/Docs/pull/470"},"issue":{"href":"https://api.github.com/repos/aspnet/Docs/issues/470"},"comments":{"href":"https://api.github.com/repos/aspnet/Docs/issues/470/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/470/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Docs/pulls/470/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Docs/statuses/00462592bcdcf0389c9f0a808e5b54f184427972"}}}}