You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Introduction to Identity with ASP.NET Core 2 API's (#4236)
* Changes to split out the ASP.NET Core 2 Identity cofig from ASP.NET Core 1.
* Fix problem with number rendering
Show differences between ASP.NET Core 1.x and 2.x config.
* Fix extra spaces
Add snippet_ prefix to regions
* Correct what UseAuthentication does.
* Update snippet regions with snippet_ prefix.
These services are made available to the application through [dependency injection](xref:fundamentals/dependency-injection).
50
-
51
-
Identity is enabled for the application by calling `UseIdentity` in the `Configure` method. `UseIdentity` adds cookie-based authentication [middleware](xref:fundamentals/middleware) to the request pipeline.
Identity is enabled for the application by calling `UseAuthentication` in the `Configure` method. `UseAuthentication` adds authentication [middleware](xref:fundamentals/middleware) to the request pipeline.
These services are made available to the application through [dependency injection](xref:fundamentals/dependency-injection).
62
+
63
+
Identity is enabled for the application by calling `UseIdentity` in the `Configure` method. `UseIdentity` adds cookie-based authentication [middleware](xref:fundamentals/middleware) to the request pipeline.
@@ -81,7 +95,7 @@ In this topic, you'll learn how to use ASP.NET Core Identity to add functionalit
81
95
82
96
Users can sign in by clicking the **Log in** link at the top of the site, or they may be navigated to the Login page if they attempt to access a part of the site that requires authorization. When the user submits the form on the Login page, the ``AccountController`` ``Login`` action is called.
The preceding code above calls the `_signInManager.SignOutAsync` method. The `SignOutAsync` method clears the user's claims stored in a cookie.
97
111
98
112
6. Configuration.
99
113
100
114
Identity has some default behaviors that you can override in your application's startup class. You do not need to configure ``IdentityOptions`` if you are using the default behaviors.
Copy file name to clipboardExpand all lines: aspnetcore/security/authentication/identity/sample/src/ASPNET-IdentityDemo/Controllers/AccountController.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ public IActionResult Login(string returnUrl = null)
48
48
ViewData["ReturnUrl"]=returnUrl;
49
49
returnView();
50
50
}
51
-
#region login
51
+
#region snippet_login
52
52
//
53
53
// POST: /Account/Login
54
54
[HttpPost]
@@ -97,7 +97,7 @@ public IActionResult Register()
97
97
{
98
98
returnView();
99
99
}
100
-
#region register
100
+
#region snippet_register
101
101
//
102
102
// POST: /Account/Register
103
103
[HttpPost]
@@ -129,7 +129,7 @@ public async Task<IActionResult> Register(RegisterViewModel model)
0 commit comments