Skip to content

Commit ab25e19

Browse files
committed
MIW 0.2.0 Update
1 parent 9c13a6c commit ab25e19

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public void ConfigureServices(IServiceCollection services)
3333
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
3434
options.HandleSameSiteCookieCompatibility();
3535
});
36-
services.AddSignIn(Configuration)
37-
.AddWebAppCallsProtectedWebApi(Configuration, new string[] { Configuration["TodoList:TodoListScope"] })
36+
services.AddMicrosoftWebAppAuthentication(Configuration)
37+
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Configuration["TodoList:TodoListScope"] })
3838
.AddInMemoryTokenCaches();
3939
services.AddTodoListService(Configuration);
4040
services.AddControllersWithViews(options =>

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/ToDoListClient.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.Graph" Version="3.7.0" />
9-
<PackageReference Include="Microsoft.Identity.Web" Version="0.1.5-preview" />
10-
<PackageReference Include="Microsoft.Identity.Web.UI" Version="0.1.5-preview" />
8+
<PackageReference Include="Microsoft.Graph" Version="3.8.0" />
9+
<PackageReference Include="Microsoft.Identity.Web" Version="0.2.0-preview" />
10+
<PackageReference Include="Microsoft.Identity.Web.UI" Version="0.2.0-preview" />
1111
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
1212
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1313
</ItemGroup>

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Controllers/TodoListController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public async Task<List<string>> CallGraphApiOnBehalfOfUser()
174174
}
175175
catch (MsalUiRequiredException ex)
176176
{
177-
_tokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeader(scopes, ex);
177+
await _tokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeaderAsync(scopes, ex);
178178
throw (ex);
179179
}
180180
}

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Startup.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ public void ConfigureServices(IServiceCollection services)
2727
{
2828
// Setting configuration for protected web api
2929

30-
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
31-
.AddProtectedWebApi(Configuration);
30+
services.AddMicrosoftWebApiAuthentication(Configuration)
31+
.AddMicrosoftWebApiCallsWebApi(Configuration)
32+
.AddInMemoryTokenCaches();
3233

3334
// Comment above lines of code and uncomment this section if you would like to validate ID tokens for allowed tenantIds
3435
//services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
@@ -47,10 +48,6 @@ public void ConfigureServices(IServiceCollection services)
4748
// },
4849
// options => { Configuration.Bind("AzureAd", options); });
4950

50-
services.AddProtectedWebApiCallsProtectedWebApi(Configuration)
51-
.AddInMemoryTokenCaches();
52-
53-
//services.AddProtectedWebApi(Configuration);
5451
// Creating policies that wraps the authorization requirements
5552
services.AddAuthorization();
5653

4-WebApp-your-API/4-3-AnyOrg/TodoListService/TodoListService.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="Microsoft.Graph" Version="3.7.0" />
19-
<PackageReference Include="Microsoft.Identity.Web" Version="0.1.5-preview" />
18+
<PackageReference Include="Microsoft.Graph" Version="3.8.0" />
19+
<PackageReference Include="Microsoft.Identity.Web" Version="0.2.0-preview" />
2020
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
2121
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3" Condition="'$(Configuration)' == 'Debug'" />
2222
</ItemGroup>

0 commit comments

Comments
 (0)