Skip to content

Commit 11b975f

Browse files
authored
Secure data topic updates (dotnet#9899)
1 parent 46729ad commit 11b975f

File tree

7 files changed

+35
-22
lines changed

7 files changed

+35
-22
lines changed

aspnetcore/security/authorization/secure-data.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create an ASP.NET Core app with user data protected by authorization
33
author: rick-anderson
44
description: Learn how to create a Razor Pages app with user data protected by authorization. Includes HTTPS, authentication, security, ASP.NET Core Identity.
55
ms.author: riande
6-
ms.date: 7/24/2018
6+
ms.date: 12/07/2018
77
ms.custom: seodec18
88
uid: security/authorization/secure-data
99
---
@@ -277,25 +277,32 @@ See [this issue](https://github.com/aspnet/Docs/issues/8502) for information on:
277277

278278
## Test the completed app
279279

280+
If you haven't already set a password for seeded user accounts, use the [Secret Manager tool](xref:security/app-secrets#secret-manager) to set a password:
281+
282+
* Choose a strong password: Use eight or more characters and at least one upper-case character, number, and symbol. For example, `Passw0rd!` meets the strong password requirements.
283+
* Execute the following command from the project's folder, where `<PW>` is the password:
284+
285+
```console
286+
dotnet user-secrets set SeedUserPW <PW>
287+
```
288+
280289
If the app has contacts:
281290

282-
* Delete all the records in the `Contact` table.
291+
* Delete all of the records in the `Contact` table.
283292
* Restart the app to seed the database.
284293

285-
Register a user for browsing the contacts.
286-
287-
An easy way to test the completed app is to launch three different browsers (or incognito/InPrivate versions). In one browser, register a new user (for example, `[email protected]`). Sign in to each browser with a different user. Verify the following operations:
294+
An easy way to test the completed app is to launch three different browsers (or incognito/InPrivate sessions). In one browser, register a new user (for example, `[email protected]`). Sign in to each browser with a different user. Verify the following operations:
288295

289-
* Registered users can view all the approved contact data.
296+
* Registered users can view all of the approved contact data.
290297
* Registered users can edit/delete their own data.
291-
* Managers can approve or reject contact data. The `Details` view shows **Approve** and **Reject** buttons.
292-
* Administrators can approve/reject and edit/delete any data.
293-
294-
| User| Options |
295-
| ------------ | ---------|
296-
| [email protected] | Can edit/delete own data |
297-
| [email protected] | Can approve/reject and edit/delete own data |
298-
| [email protected] | Can edit/delete and approve/reject all data|
298+
* Managers can approve/reject contact data. The `Details` view shows **Approve** and **Reject** buttons.
299+
* Administrators can approve/reject and edit/delete all data.
300+
301+
| User | Seeded by the app | Options |
302+
| ------------------- | :---------------: | ---------------------------------------- |
303+
| [email protected] | No | Edit/delete the own data. |
304+
| [email protected] | Yes | Approve/reject and edit/delete own data. |
305+
| [email protected] | Yes | Approve/reject and edit/delete all data. |
299306

300307
Create a contact in the administrator's browser. Copy the URL for delete and edit from the administrator contact. Paste these links into the test user's browser to verify the test user can't perform these operations.
301308

aspnetcore/security/authorization/secure-data/samples/final2.1/ContactManager.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.App" />
1111
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" PrivateAssets="All" />
1212
</ItemGroup>
1313

aspnetcore/security/authorization/secure-data/samples/final2.1/Pages/Error.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616

1717
<h3>Development Mode</h3>
1818
<p>
19-
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
2020
</p>
2121
<p>
22-
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
2326
</p>

aspnetcore/security/authorization/secure-data/samples/final2.1/Pages/Error.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
namespace ContactManager.Pages
1010
{
11+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
1112
public class ErrorModel : PageModel
1213
{
1314
public string RequestId { get; set; }
1415

1516
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1617

17-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
1818
public void OnGet()
1919
{
2020
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

aspnetcore/security/authorization/secure-data/samples/starter2.1/ContactManager.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
55
<UserSecretsId>aspnet-ContactManager-7A098A32-4BE0-4A2D-89E1-F082633B4EC9</UserSecretsId>
66
</PropertyGroup>
77

aspnetcore/security/authorization/secure-data/samples/starter2.1/Pages/Error.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616

1717
<h3>Development Mode</h3>
1818
<p>
19-
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
2020
</p>
2121
<p>
22-
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
2326
</p>

aspnetcore/security/authorization/secure-data/samples/starter2.1/Pages/Error.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
namespace ContactManager.Pages
1010
{
11+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
1112
public class ErrorModel : PageModel
1213
{
1314
public string RequestId { get; set; }
1415

1516
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1617

17-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
1818
public void OnGet()
1919
{
2020
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

0 commit comments

Comments
 (0)