File tree Expand file tree Collapse file tree 5 files changed +11
-14
lines changed
4-WebApp-your-API/4-3-AnyOrg Expand file tree Collapse file tree 5 files changed +11
-14
lines changed Original file line number Diff line number Diff 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 =>
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments