Skip to content

Commit ab39e6a

Browse files
author
Tiago Brenck
authored
Merge pull request #330 from Azure-Samples/tibre/329
Fix for issue 329
2 parents 610e507 + 9bcd587 commit ab39e6a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

4-WebApp-your-API/4-2-B2C/README-incremental-instructions.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,11 @@ These instructions only list the additional set of steps needed over the previou
115115

116116
1. 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
239236
using 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

Comments
 (0)