Skip to content

Commit b3b753c

Browse files
author
Tiago Brenck
committed
Merge branch 'master' into tibre/1_6_improvements
2 parents b161c5b + 6a47230 commit b3b753c

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,8 @@ using Microsoft.Identity.Web.Client.TokenCacheProviders;
249249
with
250250

251251
```Csharp
252-
services.AddProtectWebApiWithMicrosoftIdentityPlatformV2(Configuration)
253-
.AddProtectedApiCallsWebApis(Configuration,
254-
new string[] { Configuration["TodoList:TodoListScope"] })
255-
AddInMemoryTokenCaches();
252+
services.AddProtectWebApiWithMicrosoftIdentityPlatformV2(Configuration)
253+
.AddInMemoryTokenCaches();
256254
```
257255

258256
`AddProtectWebApiWithMicrosoftIdentityPlatformV2` does the following:

4-WebApp-your-API/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ NOTE: Remember, the To-Do list is stored in memory in this `TodoListService` app
212212

213213
### Creating the client web app (TodoListClient)
214214

215-
#### Option 2: Create the sample from the command line
215+
#### Step 1: Create the sample from the command line
216216

217217
1. Run the following command to create a sample from the command line using the `SingleOrg` template:
218218

@@ -224,6 +224,8 @@ NOTE: Remember, the To-Do list is stored in memory in this `TodoListService` app
224224

225225
> Note: Replace *`Enter_the_Application_Id_here`* with the *Application Id* from the application Id you just registered in the Application Registration Portal and *`<yourTenantId>`* with the *Directory (tenant) ID* where you created your application.
226226

227+
#### Step 2: Modified the generated code
228+
227229
1. Open the generated project (.csproj) in Visual Studio, and save the solution.
228230
1. Add the `Microsoft.Identity.Web.csproj` project which is located at the root of this sample repo, to your solution (**Add Existing Project ...**). It's used to simplify signing-in and, in the next tutorial phases, to get a token.
229231
1. Add a reference from your newly generated project to `Microsoft.Identity.Web` (right click on the **Dependencies** node under your new project, and choose **Add Reference ...**, and then in the projects tab find the `Microsoft.Identity.Web` project)
@@ -264,7 +266,7 @@ NOTE: Remember, the To-Do list is stored in memory in this `TodoListService` app
264266
services.AddTodoListService(Configuration);
265267
```
266268
267-
1. Open the `appsettings.json` file and copy the keys from the sample's corresponding file under the `AzureAd` and `TodoList` sections.
269+
1. Open the `appsettings.json` file and copy the keys from the sample's corresponding file under the `AzureAd` and `TodoList` sections.
268270

269271
#### Add a model (TodoListItem) and add the controller and views
270272

@@ -286,7 +288,7 @@ NOTE: Remember, the To-Do list is stored in memory in this `TodoListService` app
286288
287289
The code for the TodoListService was created in the following way:
288290
289-
#### Create the web api using the ASP.NET Core templates
291+
#### Step 1: Create the web api using the ASP.NET Core templates
290292
291293
```Text
292294
md TodoListService
@@ -300,7 +302,7 @@ dotnet new webapi -au=SingleOrg
300302
301303
In the TodoListService project, add a folder named `Models` and then create a new file named `TodoItem.cs`. Copy the contents of the TodoListService\Models\TodoItem.cs in this file.
302304
303-
### Modify the startup.cs file to validate bearer access tokens received by the Web API
305+
### Modify the Startup.cs file to validate bearer access tokens received by the Web API
304306
305307
1. Add the `Microsoft.Identity.Web.csproj` project which is located at the root of this sample repo, to your solution (**Add Existing Project ...**).
306308
1. Add a reference from your newly generated project to `Microsoft.Identity.Web` (right click on the **Dependencies** node under your new project, and choose **Add Reference ...**, and then in the projects tab find the `Microsoft.Identity.Web` project)
@@ -323,10 +325,8 @@ using Microsoft.Identity.Web.Client.TokenCacheProviders;
323325
with
324326
325327
```Csharp
326-
services.AddProtectWebApiWithMicrosoftIdentityPlatformV2(Configuration)
327-
.AddProtectedApiCallsWebApis(Configuration,
328-
new string[] { Configuration["TodoList:TodoListScope"] })
329-
AddInMemoryTokenCaches();
328+
services.AddProtectWebApiWithMicrosoftIdentityPlatformV2(Configuration)
329+
.AddInMemoryTokenCaches();
330330
```
331331
332332
`AddProtectWebApiWithMicrosoftIdentityPlatformV2` does the following:
@@ -335,7 +335,7 @@ using Microsoft.Identity.Web.Client.TokenCacheProviders;
335335
- sets the audiences to validate
336336
- register an issuer validator that accepts issuers to be in the Microsoft identity platform clouds.
337337
338-
The implementations of these classes are in the Microsoft.Identity.Web library (and folder), and they are designed to be reusable in your applications (Web apps and Web apis). You are encouraged to browse the code in the library to understand the changes in detail.
338+
The implementations of these classes are in the `Microsoft.Identity.Web` library (and folder), and they are designed to be reusable in your applications (Web apps and Web apis). You are encouraged to browse the code in the library to understand the changes in detail.
339339
340340
- At the beginning of the `Configure` method, insert `app.UseSession()`. This code ensures that the session exists for the session-based token cache to work properly. You can skip this if you do not plan to use the session based token cache.
341341

Microsoft.Identity.Web/Client/TokenAcquisition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public async Task RemoveAccount(RedirectContext context)
282282

283283
if (account != null)
284284
{
285-
this.UserTokenCacheProvider?.Clear(account.HomeAccountId.Identifier);
285+
this.UserTokenCacheProvider?.Clear(user.GetMsalAccountId());
286286

287287
await app.RemoveAsync(account);
288288
}

0 commit comments

Comments
 (0)