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
By [Rick Anderson](https://twitter.com/RickAndMSFT)
15
-
16
14
ASP.NET Core Identity:
17
15
18
16
* Is an API that supports user interface (UI) login functionality.
@@ -28,6 +26,8 @@ Identity is typically configured using a SQL Server database to store user names
28
26
29
27
In this topic, you learn how to use Identity to register, log in, and log out a user. Note: the templates treat username and email as the same for users. For more detailed instructions about creating apps that use Identity, see [Next Steps](#next).
30
28
29
+
For more information on Identity in Blazor apps, see <xref:blazor/security/index> and the articles that follow it in the Blazor documentation.
30
+
31
31
ASP.NET Core Identity isn't related to the [Microsoft identity platform](/azure/active-directory/develop/). Microsoft identity platform is:
32
32
33
33
* An evolution of the Azure Active Directory (Azure AD) developer platform.
@@ -39,7 +39,49 @@ ASP.NET Core Identity isn't related to the [Microsoft identity platform](/azure/
39
39
40
40
<aname="adi"></a>
41
41
42
-
## Create a Web app with authentication
42
+
## Create a Blazor Web App with authentication
43
+
44
+
Create an ASP.NET Core Blazor Web App project with Individual Accounts.
45
+
46
+
> [!NOTE]
47
+
> For a Razor Pages experience, see the [Create a Razor Pages app with authentication](#create-a-razor-pages-app-with-authentication) section.
48
+
49
+
# [Visual Studio](#tab/visual-studio)
50
+
51
+
* Select the **Blazor Web App** template and select **Next**. Name the project **BlazorApp1** to have the same namespace as the project download. Select **Next**.
52
+
* Make the following selections:
53
+
***Authentication type**: **Individual Accounts**
54
+
***Interactive render mode**: **Server**
55
+
***Interactivity Location**: **Global**
56
+
* Select **Create**.
57
+
58
+
# [.NET CLI](#tab/net-cli)
59
+
60
+
```dotnetcli
61
+
dotnet new blazor -au Individual -o BlazorApp1
62
+
```
63
+
64
+
The preceding command creates a Blazor Web App using SQLite. To create the web app with LocalDB, run the following command:
65
+
66
+
```dotnetcli
67
+
dotnet new blazor -au Individual -uld -o BlazorApp1
68
+
```
69
+
70
+
---
71
+
72
+
The generated project includes Identity Razor components. The components are found in the `Components/Account` folder of the project. For example:
73
+
74
+
*`/Components/Account/Pages/Register`
75
+
*`/Components/Account/Pages/Login`
76
+
*`/Components/Account/Pages/ChangePassword`
77
+
78
+
Blazor Identity components can be viewed in the [Blazor project template ASP.NET Core reference source (`dotnet/aspnetcore` GitHub repository)](https://github.com/dotnet/aspnetcore/tree/main/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account).
For more information, see <xref:blazor/security/index> and the articles that follow it in the Blazor documentation. Most of the articles in the *Security and Identity* area of the main ASP.NET Core documentation set apply to Blazor apps. However, the Blazor documentation set contains articles and guidance that supercedes or adds information. We recommend studying the general ASP.NET Core documentation set first, followed by accessing the articles in the Blazor *Security and Identity* documentation.
83
+
84
+
## Create a Razor Pages app with authentication
43
85
44
86
Create an ASP.NET Core Web Application project with Individual Accounts.
The generated project provides [ASP.NET Core Identity](xref:security/authentication/identity) as a [Razor class library](xref:razor-pages/ui-class). The Identity Razor class library exposes endpoints with the `Identity` area. For example:
66
108
67
-
* /Identity/Account/Login
68
-
* /Identity/Account/Logout
69
-
* /Identity/Account/Manage
109
+
*`/Identity/Account/Login`
110
+
*`/Identity/Account/Logout`
111
+
*`/Identity/Account/Manage`
112
+
113
+
Pages are described individually in the documentation for specific use cases and are subject to change each release. To view all of the pages, see the [ASP.NET Core reference source (`dotnet/aspnetcore` GitHub repository, `Identity/UI/src/Areas/Identity/Pages` folder)](https://github.com/dotnet/aspnetcore/tree/main/src/Identity/UI/src/Areas/Identity/Pages).
70
114
71
115
### Apply migrations
72
116
@@ -243,10 +287,11 @@ To prevent publishing static Identity assets (stylesheets and JavaScript files f
*See [this GitHub issue](https://github.com/dotnet/AspNetCore.Docs/issues/5131) for information on configuring Identity using SQLite.
294
+
*For information on configuring Identity using SQLite, see [How to config Identity for SQLite (`dotnet/AspNetCore.Docs`#5131)](https://github.com/dotnet/AspNetCore.Docs/issues/5131).
0 commit comments