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,34 +39,119 @@ 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.
43
45
44
-
Create an ASP.NET Core Web Application project with Individual Accounts.
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
+
> For an MVC experience, see the [Create an MVC app with authentication](#create-an-mvc-app-with-authentication) section.
45
50
46
51
# [Visual Studio](#tab/visual-studio)
47
52
48
-
* Select the **ASP.NET Core Web App** template. Name the project **WebApp1** to have the same namespace as the project download. Click **OK**.
49
-
* In the **Authentication type** input, select **Individual Accounts**.
53
+
* Select the **Blazor Web App** template. Select **Next**.
54
+
* Make the following selections:
55
+
***Authentication type**: **Individual Accounts**
56
+
***Interactive render mode**: **Server**
57
+
***Interactivity Location**: **Global**
58
+
* Select **Create**.
50
59
51
60
# [.NET CLI](#tab/net-cli)
52
61
53
62
```dotnetcli
54
-
dotnet new webapp --auth Individual -o WebApp1
63
+
dotnet new blazor -au Individual -o BlazorApp1
55
64
```
56
65
57
-
The preceding command creates a Razor web app using SQLite. To create the web app with LocalDB, run the following command:
66
+
The `-o|--output` option creates a folder for the app and sets the app name/namespace.
67
+
68
+
The preceding command creates a Blazor Web App using SQLite. To create the app with LocalDB, run the following command:
58
69
59
70
```dotnetcli
60
-
dotnet new webapp --auth Individual -uld -o WebApp1
71
+
dotnet new blazor -au Individual -uld -o BlazorApp1
61
72
```
62
73
63
74
---
64
75
65
-
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:
76
+
The generated project includes Identity Razor components. The components are found in the `Components/Account` folder. For example:
Identity Razor components are described individually in the documentation for specific use cases and are subject to change each release. When you generate a Blazor Web App with Individual Accounts, Identity Razor components are included in the generated project. The Identity Razor components can also be inspected in the [Blazor project template in the 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 supersedes 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.
87
+
88
+
## Create a Razor Pages app with authentication
89
+
90
+
Create an ASP.NET Core Web Application (Razor Pages) project with Individual Accounts.
91
+
92
+
# [Visual Studio](#tab/visual-studio)
93
+
94
+
* Select the **ASP.NET Core Web App (Razor Pages)** template. Select **Next**.
95
+
* For **Authentication type**, select **Individual Accounts**.
96
+
* Select **Create**.
97
+
98
+
# [.NET CLI](#tab/net-cli)
99
+
100
+
```dotnetcli
101
+
dotnet new webapp -au Individual -o WebApp1
102
+
```
103
+
104
+
The `-o|--output` option creates a folder for the app and sets the app name/namespace.
105
+
106
+
The preceding command creates a Razor Pages app using SQLite. To create the app with LocalDB, run the following command:
107
+
108
+
```dotnetcli
109
+
dotnet new webapp -au Individual -uld -o WebApp1
110
+
```
111
+
112
+
---
113
+
114
+
The generated project provides [ASP.NET Core Identity](xref:security/authentication/identity) as a [Razor class library (RCL)](xref:razor-pages/ui-class). The Identity Razor class library exposes endpoints with the `Identity` area. For example:
Pages are described individually in the documentation for specific use cases and are subject to change each release. To view all of the pages in the RCL, 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). You can *scaffold* individual pages or all of the pages into the app. For more information, see <xref:security/authentication/scaffold-identity>.
121
+
122
+
## Create an MVC app with authentication
123
+
124
+
Create an ASP.NET Core MVC project with Individual Accounts.
125
+
126
+
# [Visual Studio](#tab/visual-studio)
127
+
128
+
* Select the **ASP.NET Core Web App (Model-View-Controller)** template. Select **Next**.
129
+
* For **Authentication type**, select **Individual Accounts**.
130
+
* Select **Create**.
131
+
132
+
# [.NET CLI](#tab/net-cli)
133
+
134
+
```dotnetcli
135
+
dotnet new mvc -au Individual -o WebApplication1
136
+
```
137
+
138
+
The `-o|--output` option creates a folder for the app and sets the app name/namespace.
139
+
140
+
The preceding command creates an MVC app using SQLite. To create the web app with LocalDB, run the following command:
141
+
142
+
```dotnetcli
143
+
dotnet new mvc -au Individual -uld -o WebApplication1
144
+
```
145
+
146
+
---
147
+
148
+
The generated project provides [ASP.NET Core Identity](xref:security/authentication/identity) as a [Razor class library (RCL)](xref:razor-pages/ui-class). The Identity Razor class library is based on Razor Pages and exposes endpoints with the `Identity` area. For example:
Pages are described individually in the documentation for specific use cases and are subject to change each release. To view all of the pages in the RCL, 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). You can *scaffold* individual pages or all of the pages into the app. For more information, see <xref:security/authentication/scaffold-identity>.
70
155
71
156
### Apply migrations
72
157
@@ -243,10 +328,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.
335
+
*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