Skip to content

Commit 2a023ef

Browse files
committed
Revert "[Fixes #17014] Add an auth-enabled template for Blazor WASM projects (#18354)"
This reverts commit e64b8a9.
1 parent c7e6bee commit 2a023ef

34 files changed

+11
-2259
lines changed

eng/Versions.props

-4
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@
204204
<SystemThreadingTasksExtensionsPackageVersion>4.5.2</SystemThreadingTasksExtensionsPackageVersion>
205205
<!-- Packages developed by @aspnet, but manually updated as necessary. -->
206206
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
207-
<MicrosoftAspNetCoreIdentityUIPackageVersion>3.1.0</MicrosoftAspNetCoreIdentityUIPackageVersion>
208-
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>3.1.0</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
209-
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>3.1.0</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
210-
<MicrosoftAspNetCoreComponentsAuthorizationPackageVersion>3.1.0</MicrosoftAspNetCoreComponentsAuthorizationPackageVersion>
211207
<MicrosoftAspNetWebApiClientPackageVersion>5.2.6</MicrosoftAspNetWebApiClientPackageVersion>
212208
<!-- Partner teams -->
213209
<MicrosoftAzureKeyVaultPackageVersion>2.3.2</MicrosoftAzureKeyVaultPackageVersion>

src/ProjectTemplates/BlazorWasm.ProjectTemplates/BlazorWasm-CSharp.Client.csproj.in

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="${MicrosoftAspNetCoreBlazorBuildPackageVersion}" PrivateAssets="all" />
1111
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="${MicrosoftAspNetCoreBlazorDevServerPackageVersion}" PrivateAssets="all" />
1212
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="${MicrosoftAspNetCoreBlazorHttpClientPackageVersion}" />
13-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="${MicrosoftAspNetCoreComponentsAuthorizationPackageVersion}" Condition="'$(IndividualLocalAuth)' == 'true'" />
1413
</ItemGroup>
1514
<!--#if Hosted -->
1615
<ItemGroup>

src/ProjectTemplates/BlazorWasm.ProjectTemplates/BlazorWasm-CSharp.Server.csproj.in

-17
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,4 @@
1313
<ProjectReference Include="..\Shared\BlazorWasm-CSharp.Shared.csproj" />
1414
</ItemGroup>
1515

16-
<!--#if (IndividualLocalAuth && !UseLocalDB) -->
17-
<ItemGroup>
18-
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
19-
</ItemGroup>
20-
21-
<!--#endif -->
22-
<!--#if (IndividualLocalAuth) -->
23-
<ItemGroup>
24-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" />
25-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" />
26-
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" />
27-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition="'$(UseLocalDB)' == 'True'" />
28-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition="'$(UseLocalDB)' != 'True'" />
29-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" />
30-
</ItemGroup>
31-
32-
<!--#endif -->
3316
</Project>

src/ProjectTemplates/BlazorWasm.ProjectTemplates/Microsoft.AspNetCore.Blazor.Templates.csproj

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@
2020
MicrosoftAspNetCoreBlazorBuildPackageVersion=$(MicrosoftAspNetCoreBlazorBuildPackageVersion);
2121
MicrosoftAspNetCoreBlazorDevServerPackageVersion=$(MicrosoftAspNetCoreBlazorDevServerPackageVersion);
2222
MicrosoftAspNetCoreBlazorHttpClientPackageVersion=$(MicrosoftAspNetCoreBlazorHttpClientPackageVersion);
23-
MicrosoftAspNetCoreBlazorServerPackageVersion=$(MicrosoftAspNetCoreBlazorServerPackageVersion);
24-
MicrosoftAspNetCoreComponentsAuthorizationPackageVersion=$(MicrosoftAspNetCoreComponentsAuthorizationPackageVersion);
25-
MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion=$(MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion);
26-
MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion=$(MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion);
27-
MicrosoftAspNetCoreIdentityUIPackageVersion=$(MicrosoftAspNetCoreIdentityUIPackageVersion);
28-
MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion);
29-
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
30-
MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion);
3123
MonoWebAssemblyInteropPackageVersion=$(MonoWebAssemblyInteropPackageVersion);
24+
MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion);
25+
MicrosoftAspNetCoreBlazorServerPackageVersion=$(MicrosoftAspNetCoreBlazorServerPackageVersion);
3226
</GeneratedContentProperties>
3327
</PropertyGroup>
3428

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/.template.config/dotnetcli.host.json

+4-24
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,11 @@
55
"longName": "no-restore",
66
"shortName": ""
77
},
8-
"Hosted": {
9-
"longName": "hosted"
10-
},
8+
"Hosted": {
9+
"longName": "hosted"
10+
},
1111
"Framework": {
1212
"longName": "framework"
13-
},
14-
"UseLocalDB": {
15-
"longName": "use-local-db"
16-
},
17-
"HttpPort": {
18-
"isHidden": true
19-
},
20-
"HttpsPort": {
21-
"isHidden": true
22-
},
23-
"ExcludeLaunchSettings": {
24-
"longName": "exclude-launch-settings",
25-
"shortName": ""
26-
},
27-
"UserSecretsId": {
28-
"isHidden": true
29-
},
30-
"NoHttps": {
31-
"longName": "no-https",
32-
"shortName": ""
3313
}
3414
}
35-
}
15+
}

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/.template.config/template.json

-181
Original file line numberDiff line numberDiff line change
@@ -74,82 +74,6 @@
7474
"exclude": [
7575
"*.sln"
7676
]
77-
},
78-
{
79-
"condition": "(!IndividualLocalAuth || UseLocalDB)",
80-
"exclude": [
81-
"Server/app.db"
82-
]
83-
},
84-
{
85-
"condition": "(!IndividualLocalAuth)",
86-
"exclude": [
87-
"Server/Data/SqlLite/**",
88-
"Server/Data/SqlServer/**",
89-
"Server/Data/ApplicationDbContext.cs",
90-
"Server/Areas/**"
91-
]
92-
},
93-
{
94-
"condition": "(IndividualLocalAuth && UseLocalDB)",
95-
"rename": {
96-
"Server/Data/SqlServer/": "Server/Data/Migrations/"
97-
},
98-
"exclude": [
99-
"Server/Data/SqlLite/**"
100-
]
101-
},
102-
{
103-
"condition": "(IndividualLocalAuth && !UseLocalDB)",
104-
"rename": {
105-
"Server/Data/SqlLite/": "Server/Data/Migrations/"
106-
},
107-
"exclude": [
108-
"Server/Data/SqlServer/**"
109-
]
110-
},
111-
{
112-
"condition": "(NoAuth && Hosted)",
113-
"rename": {
114-
"Client/Shared/MainLayout.NoAuth.razor": "Client/Shared/MainLayout.razor"
115-
},
116-
"exclude": [
117-
"Client/Shared/LoginDisplay.*.razor",
118-
"Client/Shared/MainLayout.Auth.razor"
119-
]
120-
},
121-
{
122-
"condition": "(!Hosted)",
123-
"rename": {
124-
"Client/Shared/MainLayout.NoAuth.razor": "Shared/MainLayout.razor"
125-
},
126-
"exclude": [
127-
"Client/Shared/LoginDisplay.*.razor",
128-
"Client/Shared/MainLayout.Auth.razor"
129-
]
130-
},
131-
{
132-
"condition": "(!NoAuth && Hosted)",
133-
"rename": {
134-
"Client/Shared/MainLayout.Auth.razor": "Client/Shared/MainLayout.razor"
135-
},
136-
"exclude": [
137-
"Client/Shared/MainLayout.NoAuth.razor"
138-
]
139-
},
140-
{
141-
"condition": "(IndividualLocalAuth)",
142-
"rename": {
143-
"Client/Shared/LoginDisplay.IndividualLocalAuth.razor": "Client/Shared/LoginDisplay.razor"
144-
}
145-
},
146-
{
147-
"condition": "(NoAuth)",
148-
"exclude": [
149-
"Client/Services/HostAuthenticationStateProvider.cs",
150-
"Server/Controllers/UserController.cs",
151-
"Shared/Authorization/*"
152-
]
15377
}
15478
]
15579
}
@@ -183,111 +107,6 @@
183107
"datatype": "bool",
184108
"defaultValue": "false",
185109
"description": "If specified, includes an ASP.NET Core host for the Blazor app."
186-
},
187-
"auth": {
188-
"type": "parameter",
189-
"datatype": "choice",
190-
"choices": [
191-
{
192-
"choice": "None",
193-
"description": "No authentication"
194-
},
195-
{
196-
"choice": "Individual",
197-
"description": "Individual authentication"
198-
}
199-
],
200-
"defaultValue": "None",
201-
"description": "The type of authentication to use"
202-
},
203-
"UserSecretsId": {
204-
"type": "parameter",
205-
"datatype": "string",
206-
"replaces": "aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502",
207-
"defaultValue": "aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502",
208-
"description": "The ID to use for secrets (use with OrgReadAccess or Individual auth)."
209-
},
210-
"ExcludeLaunchSettings": {
211-
"type": "parameter",
212-
"datatype": "bool",
213-
"defaultValue": "false",
214-
"description": "Whether to exclude launchSettings.json from the generated template."
215-
},
216-
"HttpPort": {
217-
"type": "parameter",
218-
"datatype": "integer",
219-
"description": "Port number to use for the HTTP endpoint in launchSettings.json."
220-
},
221-
"HttpPortGenerated": {
222-
"type": "generated",
223-
"generator": "port"
224-
},
225-
"HttpPortReplacer": {
226-
"type": "generated",
227-
"generator": "coalesce",
228-
"parameters": {
229-
"sourceVariableName": "HttpPort",
230-
"fallbackVariableName": "HttpPortGenerated"
231-
},
232-
"replaces": "8080"
233-
},
234-
"HttpsPort": {
235-
"type": "parameter",
236-
"datatype": "integer",
237-
"description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)."
238-
},
239-
"HttpsPortGenerated": {
240-
"type": "generated",
241-
"generator": "port",
242-
"parameters": {
243-
"low": 44300,
244-
"high": 44399
245-
}
246-
},
247-
"HttpsPortReplacer": {
248-
"type": "generated",
249-
"generator": "coalesce",
250-
"parameters": {
251-
"sourceVariableName": "HttpsPort",
252-
"fallbackVariableName": "HttpsPortGenerated"
253-
},
254-
"replaces": "44300"
255-
},
256-
"IndividualLocalAuth": {
257-
"type": "computed",
258-
"value": "(auth == \"Individual\")"
259-
},
260-
"NoAuth": {
261-
"type": "computed",
262-
"value": "(!(IndividualAuth))"
263-
},
264-
"IndividualAuth": {
265-
"type": "computed",
266-
"value": "(IndividualLocalAuth)"
267-
},
268-
"RequiresHttps": {
269-
"type": "computed",
270-
"value": "(IndividualAuth || !NoHttps)"
271-
},
272-
"NoHttps": {
273-
"type": "parameter",
274-
"datatype": "bool",
275-
"defaultValue": "false",
276-
"description": "Whether to turn off HTTPS. This option only applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth."
277-
},
278-
"UseLocalDB": {
279-
"type": "parameter",
280-
"datatype": "bool",
281-
"defaultValue": "false",
282-
"description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified."
283-
},
284-
"copyrightYear": {
285-
"type": "generated",
286-
"generator": "now",
287-
"replaces": "copyrightYear",
288-
"parameters": {
289-
"format": "yyyy"
290-
}
291110
}
292111
},
293112
"tags": {

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/.template.config/vs-2017.3.host.json

-24
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,6 @@
1818
"additionalWizardParameters": {
1919
"$isMultiProjectTemplate$": "true"
2020
},
21-
"supportedAuthentications": [
22-
{
23-
"auth": "None",
24-
"authenticationType": "NoAuth",
25-
"allowUnsecured": true
26-
},
27-
{
28-
"auth": "Individual",
29-
"authenticationType": "IndividualAuth",
30-
"b2cAuthenticationOptions": "Local"
31-
}
32-
],
33-
"ports": [
34-
{
35-
"name": "HttpPort",
36-
"useHttps": false
37-
},
38-
{
39-
"name": "HttpsPort",
40-
"useHttps": true
41-
}
42-
],
43-
"excludeLaunchSettings": false,
44-
"disableHttpsSymbol": "NoHttps",
4521
"symbolInfo": [
4622
{
4723
"id": "Hosted",
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
@*#if (NoAuth)
2-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(Program).Assembly">
32
<Found Context="routeData">
43
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
54
</Found>
@@ -9,17 +8,3 @@
98
</LayoutView>
109
</NotFound>
1110
</Router>
12-
#else
13-
<CascadingAuthenticationState>
14-
<Router AppAssembly="@typeof(Program).Assembly">
15-
<Found Context="routeData">
16-
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
17-
</Found>
18-
<NotFound>
19-
<LayoutView Layout="@typeof(MainLayout)">
20-
<p>Sorry, there's nothing at this address.</p>
21-
</LayoutView>
22-
</NotFound>
23-
</Router>
24-
</CascadingAuthenticationState>
25-
#endif*@

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/Client/Pages/FetchData.razor

-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
@page "/fetchdata"
2-
@*#if (!NoAuth)
3-
@using Microsoft.AspNetCore.Authorization
4-
#endif*@
52
@*#if (Hosted)
63
@using BlazorWasm_CSharp.Shared
74
#endif*@
8-
@*#if (!NoAuth)
9-
@attribute [Authorize]
10-
#endif*@
115
@inject HttpClient Http
126

137
<h1>Weather forecast</h1>

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/Client/Program.cs

-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
using System.Text;
55
using Microsoft.AspNetCore.Blazor.Hosting;
66
using Microsoft.Extensions.DependencyInjection;
7-
#if (!NoAuth)
8-
using Microsoft.AspNetCore.Components.Authorization;
9-
#endif
107

118
#if (Hosted)
129
namespace BlazorWasm_CSharp.Client
@@ -21,13 +18,6 @@ public static async Task Main(string[] args)
2118
var builder = WebAssemblyHostBuilder.CreateDefault(args);
2219
builder.RootComponents.Add<App>("app");
2320

24-
// use builder.Services to configure application services.
25-
#if (IndividualLocalAuth)
26-
builder.Services.AddOptions();
27-
builder.Services.AddAuthorizationCore();
28-
builder.Services.AddSingleton<AuthenticationStateProvider, HostAuthenticationStateProvider>();
29-
#endif
30-
3121
await builder.Build().RunAsync();
3222
}
3323
}

0 commit comments

Comments
 (0)