@@ -115,14 +115,11 @@ These instructions only list the additional set of steps needed over the previou
115
115
116
116
1 . Select the ** Expose an API** section, and:
117
117
- Select ** Add a scope**
118
- - accept the proposed Application ID URI (api://{clientId}) by selecting ** Save and Continue**
118
+ - Accept the proposed Application ID URI (api://{clientId}) by selecting ** Save and Continue**
119
119
- Enter the following parameters
120
120
- for ** Scope name** use ` user_impersonation `
121
- - Keep ** Admins and users** for ** Who can consent**
122
121
- in ** Admin consent display name** type ` Access TodoListService-aspnetcore-webapi as a user `
123
122
- in ** Admin consent description** type ` Accesses the TodoListService-aspnetcore-webapi Web API as a user `
124
- - in ** User consent display name** type ` Access TodoListService-aspnetcore-webapi as a user `
125
- - in ** User consent description** type ` Accesses the TodoListService-aspnetcore-webapi Web API as a user `
126
123
- Keep ** State** as ** Enabled**
127
124
- Select ** Add scope**
128
125
@@ -237,21 +234,26 @@ Update `Startup.cs` file :
237
234
238
235
``` CSharp
239
236
using Microsoft .Identity .Web ;
240
- using Microsoft .Identity . Web . Client . TokenCacheProviders ;
237
+ using Microsoft .AspNetCore . Authentication . JwtBearer ;
241
238
```
242
239
243
240
- In the ` ConfigureServices ` method, replace the following code:
244
241
245
242
``` CSharp
246
243
services .AddAuthentication (AzureADDefaults .BearerAuthenticationScheme )
247
- .AddAzureADBearer (options => Configuration .Bind (" AzureAd " , options ));
244
+ .AddAzureADBearer (options => Configuration .Bind (" AzureAdB2C " , options ));
248
245
```
249
246
250
247
with
251
248
252
249
``` Csharp
253
- services .AddProtectedWebApi (Configuration )
254
- .AddInMemoryTokenCaches ();
250
+ services .AddAuthentication (JwtBearerDefaults .AuthenticationScheme )
251
+ .AddProtectedWebApi (" AzureAdB2C" , Configuration , options =>
252
+ {
253
+ Configuration .Bind (" AzureAdB2C" , options );
254
+
255
+ options .TokenValidationParameters .NameClaimType = " name" ;
256
+ });
255
257
```
256
258
257
259
- Add the method ** app.UseAuthentication()** before ** app.UseMvc()** in the ` Configure ` method
0 commit comments