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
Copy file name to clipboardExpand all lines: articles/active-directory/develop/scenario-web-app-sign-user-app-configuration.md
+12-17Lines changed: 12 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ In ASP.NET Core, these settings are located in the [appsettings.json](https://gi
89
89
"TenantId": "[Enter the tenantId here]",
90
90
91
91
// Client ID (application ID) obtained from the Azure portal
92
-
"ClientId": "[Enter the Client Id]",
92
+
"ClientId": "[Enter the Client Id here]",
93
93
"CallbackPath": "/signin-oidc",
94
94
"SignedOutCallbackPath": "/signout-oidc"
95
95
}
@@ -186,8 +186,7 @@ These parameters are used to create a configuration object in *authConfig.js* fi
186
186
187
187
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`).
188
188
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
SESSION_TYPE="filesystem"# So the token cache will be stored in a server-side session
203
202
```
204
203
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
-
>ifnotCLIENT_SECRET:
211
-
>raiseValueError("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
+
ifnotCLIENT_SECRET:
209
+
raiseValueError("Need to define CLIENT_SECRET environment variable")
210
+
```
213
211
214
212
---
215
213
@@ -219,9 +217,7 @@ The initialization code differences are platform dependant. For ASP.NET Core and
219
217
220
218
# [ASP.NET Core](#tab/aspnetcore)
221
219
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 .NET6, 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.
225
221
226
222
> [!NOTE]
227
223
> 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
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. Addthe [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.
240
235
241
236
2. Updatethecodein `ConfigureServices` sothatitusesthe `AddMicrosoftIdentityWebAppAuthentication` and `AddMicrosoftIdentityUI` methods.
242
237
@@ -275,7 +270,7 @@ To add authentication with the Microsoft identity platform (formerly Azure AD v2
275
270
```
276
271
277
272
Inthecodeabove:
278
-
- The `AddMicrosoftIdentityWebAppAuthentication` extension method is defined in**Microsoft.Identity.Web**. It:
0 commit comments