Prevent publish of static Identity assets (#16560)

pull/16566/head
Luke Latham 2020-01-15 11:25:57 -06:00 committed by GitHub
parent 2befcb424f
commit 20118bc840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 3 deletions

View File

@ -5,7 +5,7 @@ description: Learn the foundational concepts for building ASP.NET Core apps.
monikerRange: '>= aspnetcore-2.1'
ms.author: riande
ms.custom: mvc
ms.date: 11/07/2019
ms.date: 01/15/2020
uid: fundamentals/index
---
# ASP.NET Core fundamentals
@ -305,6 +305,12 @@ Prevent publishing files in *wwwroot* with the [\<Content> project item](/visual
</ItemGroup>
```
::: moniker range=">= aspnetcore-3.0"
To prevent publishing static Identity assets to the web root, see <xref:security/authentication/identity#prevent-publish-of-static-identity-assets>.
::: moniker-end
In Razor (*.cshtml*) files, the tilde-slash (`~/`) points to the web root. A path beginning with `~/` is referred to as a *virtual path*.
For more information, see <xref:fundamentals/static-files>.

View File

@ -3,7 +3,7 @@ title: Introduction to Identity on ASP.NET Core
author: rick-anderson
description: Use Identity with an ASP.NET Core app. Learn how to set password requirements (RequireDigit, RequiredLength, RequiredUniqueChars, and more).
ms.author: riande
ms.date: 12/05/2019
ms.date: 01/15/2020
uid: security/authentication/identity
---
# Introduction to Identity on ASP.NET Core
@ -208,6 +208,22 @@ See [Configuration](#pw) for a sample that sets the minimum password requirement
See [AddDefaultIdentity source](https://github.com/dotnet/AspNetCore/blob/release/3.0/src/Identity/UI/src/IdentityServiceCollectionUIExtensions.cs#L47-L63) for more information.
## Prevent publish of static Identity assets
To prevent publishing static Identity assets (stylesheets and JavaScript files for Identity UI) to the web root, add the following `ResolveStaticWebAssetsInputsDependsOn` property and `RemoveIdentityAssets` target to the app's project file:
```xml
<PropertyGroup>
<ResolveStaticWebAssetsInputsDependsOn>RemoveIdentityAssets</ResolveStaticWebAssetsInputsDependsOn>
</PropertyGroup>
<Target Name="RemoveIdentityAssets">
<ItemGroup>
<StaticWebAsset Remove="@(StaticWebAsset)" Condition="%(SourceId) == 'Microsoft.AspNetCore.Identity.UI'" />
</ItemGroup>
</Target>
```
## Next Steps
* See [this GitHub issue](https://github.com/aspnet/AspNetCore.Docs/issues/5131) for information on configuring Identity using SQLite.

View File

@ -5,7 +5,7 @@ description: Learn how to scaffold Identity in an ASP.NET Core project.
monikerRange: '>= aspnetcore-2.1'
ms.author: riande
ms.custom: mvc
ms.date: 10/24/2018
ms.date: 01/15/2020
uid: security/authentication/scaffold-identity
---
# Scaffold Identity in ASP.NET Core projects
@ -251,6 +251,10 @@ The following code outlines adding a user:
A similar approach can be followed for production scenarios.
## Prevent publish of static Identity assets
To prevent publishing static Identity assets to the web root, see <xref:security/authentication/identity#prevent-publish-of-static-identity-assets>.
## Additional resources
* [Changes to authentication code to ASP.NET Core 2.1 and later](xref:migration/20_21#changes-to-authentication-code)