@@ -115,14 +115,11 @@ These instructions only list the additional set of steps needed over the previou
115115
1161161 . Select the ** Expose an API** section, and:
117117 - 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**
119119 - Enter the following parameters
120120 - for ** Scope name** use ` user_impersonation `
121- - Keep ** Admins and users** for ** Who can consent**
122121 - in ** Admin consent display name** type ` Access TodoListService-aspnetcore-webapi as a user `
123122 - 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 `
126123 - Keep ** State** as ** Enabled**
127124 - Select ** Add scope**
128125
@@ -237,21 +234,26 @@ Update `Startup.cs` file :
237234
238235``` CSharp
239236using Microsoft .Identity .Web ;
240- using Microsoft .Identity . Web . Client . TokenCacheProviders ;
237+ using Microsoft .AspNetCore . Authentication . JwtBearer ;
241238```
242239
243240- In the ` ConfigureServices ` method, replace the following code:
244241
245242 ``` CSharp
246243 services .AddAuthentication (AzureADDefaults .BearerAuthenticationScheme )
247- .AddAzureADBearer (options => Configuration .Bind (" AzureAd " , options ));
244+ .AddAzureADBearer (options => Configuration .Bind (" AzureAdB2C " , options ));
248245 ```
249246
250247 with
251248
252249 ``` 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+ });
255257 ```
256258
257259 - Add the method ** app.UseAuthentication()** before ** app.UseMvc()** in the ` Configure ` method
0 commit comments