Skip to content

Commit b853687

Browse files
authored
second round of checks
1 parent 247afc7 commit b853687

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

articles/active-directory/develop/scenario-web-app-sign-user-app-configuration.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ In ASP.NET Core, these settings are located in the [appsettings.json](https://gi
8989
"TenantId": "[Enter the tenantId here]",
9090

9191
// Client ID (application ID) obtained from the Azure portal
92-
"ClientId": "[Enter the Client Id]",
92+
"ClientId": "[Enter the Client Id here]",
9393
"CallbackPath": "/signin-oidc",
9494
"SignedOutCallbackPath": "/signout-oidc"
9595
}
@@ -186,8 +186,7 @@ These parameters are used to create a configuration object in *authConfig.js* fi
186186

187187
In the Azure portal, the reply URIs that you register on the Authentication page for your application need to match the redirectUri instances that the application defines (`http://localhost:3000/auth/redirect`).
188188

189-
> [!NOTE]
190-
> This quickstart proposes to store the client secret in the configuration file for simplicity. In your production app, you'd want to use other ways to store your secret, such as a key vault or an environment variable.
189+
For simplicity in this article, the client secret is stored in the configuration file. In the production app, consider using a key vault or an environment variable
191190

192191
# [Python](#tab/python)
193192

@@ -202,14 +201,13 @@ SCOPE = ["User.ReadBasic.All"]
202201
SESSION_TYPE = "filesystem" # So the token cache will be stored in a server-side session
203202
```
204203

205-
> [!NOTE]
206-
> This quickstart proposes to store the client secret in the configuration file for simplicity. In your production app, you'd want to use other ways to store your secret, such as a key vault or an environment variable as described in [Flask's documentation](https://flask.palletsprojects.com/en/1.1.x/config/#configuring-from-environment-variables).
207-
>
208-
> ```python
209-
> CLIENT_SECRET = os.getenv("CLIENT_SECRET")
210-
> if not CLIENT_SECRET:
211-
> raise ValueError("Need to define CLIENT_SECRET environment variable")
212-
> ```
204+
For simplicity in this article, the client secret is stored in the configuration file. In the production app, consider using a key vault or an environment variable as described in [Flask's documentation](https://flask.palletsprojects.com/en/1.1.x/config/#configuring-from-environment-variables) to store your secret.
205+
206+
```python
207+
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
208+
if not CLIENT_SECRET:
209+
raise ValueError("Need to define CLIENT_SECRET environment variable")
210+
```
213211

214212
---
215213

@@ -219,9 +217,7 @@ The initialization code differences are platform dependant. For ASP.NET Core and
219217

220218
# [ASP.NET Core](#tab/aspnetcore)
221219

222-
In ASP.NET Core web apps (and web APIs), the application is protected because you have a `[Authorize]` attribute on the controllers or the controller actions. This attribute checks that the user is authenticated. Prior to the release of .NET 6, the code that's initializing the application is in the *Startup.cs* file. New ASP.NET Core projects with .NET 6 no longer contain a *Startup.cs* file. Taking its place is the *Program.cs* file. The rest of this tutorial pertains to .NET 5 or lower.
223-
224-
To add authentication with the Microsoft identity platform (formerly Azure AD v2.0), you'll need to add the following code. The comments in the code should be self-explanatory.
220+
In ASP.NET Core web apps (and web APIs), the application is protected because you have a `Authorize` attribute on the controllers or the controller actions. This attribute checks that the user is authenticated. Prior to the release of .NET 6, the code initializaation wis in the *Startup.cs* file. New ASP.NET Core projects with .NET 6 no longer contain a *Startup.cs* file. Taking its place is the *Program.cs* file. The rest of this tutorial pertains to .NET 5 or lower.
225221

226222
> [!NOTE]
227223
> If you want to start directly with the new ASP.NET Core templates for Microsoft identity platform, that leverage Microsoft.Identity.Web, you can download a preview NuGet package containing project templates for .NET 5.0. Then, once installed, you can directly instantiate ASP.NET Core web applications (MVC or Blazor). See [Microsoft.Identity.Web web app project templates](https://aka.ms/ms-id-web/webapp-project-templates) for details. This is the simplest approach as it will do all the steps below for you.
@@ -234,9 +230,8 @@ To add authentication with the Microsoft identity platform (formerly Azure AD v2
234230
> ```
235231
>
236232
> This code uses the legacy **Microsoft.AspNetCore.Authentication.AzureAD.UI** NuGet package which is used to create an Azure AD v1.0 application. This article explains how to create a Microsoft identity platform (Azure AD v2.0) application which replaces that code.
237-
>
238233
239-
1. Add the [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) and [Microsoft.Identity.Web.UI](https://www.nuget.org/packages/Microsoft.Identity.Web.UI) NuGet packages to your project. Remove the Microsoft.AspNetCore.Authentication.AzureAD.UI NuGet package if it is present.
234+
1. Add the [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) and [Microsoft.Identity.Web.UI](https://www.nuget.org/packages/Microsoft.Identity.Web.UI) NuGet packages to your project. Remove the `Microsoft.AspNetCore.Authentication.AzureAD.UI` NuGet package if it is present.
240235
241236
2. Update the code in `ConfigureServices` so that it uses the `AddMicrosoftIdentityWebAppAuthentication` and `AddMicrosoftIdentityUI` methods.
242237
@@ -275,7 +270,7 @@ To add authentication with the Microsoft identity platform (formerly Azure AD v2
275270
```
276271
277272
In the code above:
278-
- The `AddMicrosoftIdentityWebAppAuthentication` extension method is defined in **Microsoft.Identity.Web**. It:
273+
- The `AddMicrosoftIdentityWebAppAuthentication` extension method is defined in **Microsoft.Identity.Web**, which;
279274
- Adds the authentication service.
280275
- Configures options to read the configuration file (here from the "AzureAD" section)
281276
- Configures the OpenID Connect options so that the authority is the Microsoft identity platform.

0 commit comments

Comments
 (0)