Skip to content

Commit 3a3a97f

Browse files
authored
Surface and add IHttpClientFactory to example code (#17581)
1 parent fa4c1e7 commit 3a3a97f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

aspnetcore/security/blazor/server.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to mitigate security threats to Blazor Server apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 03/31/2020
8+
ms.date: 04/02/2020
99
no-loc: [Blazor, SignalR]
1010
uid: security/blazor/server
1111
---
@@ -100,6 +100,10 @@ The command creates a folder named with the value provided for the `{APP NAME}`
100100
Authenticate the Blazor Server app as you would with a regular Razor Pages or MVC app. Provision and save the tokens to the authentication cookie. For example:
101101

102102
```csharp
103+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
104+
105+
...
106+
103107
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
104108
{
105109
options.ResponseType = "code";
@@ -137,9 +141,13 @@ public class TokenProvider
137141
}
138142
```
139143

140-
In `Startup.ConfigureServices`, register the token provider service:
144+
In `Startup.ConfigureServices`, add services for:
145+
146+
* `IHttpClientFactory`
147+
* `TokenProvider`
141148

142149
```csharp
150+
services.AddHttpClient();
143151
services.AddScoped<TokenProvider>();
144152
```
145153

0 commit comments

Comments
 (0)