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)
33
33
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
34
34
options . HandleSameSiteCookieCompatibility ( ) ;
35
35
} ) ;
36
- services . AddSignIn ( Configuration )
37
- . AddWebAppCallsProtectedWebApi ( Configuration , new string [ ] { Configuration [ "TodoList:TodoListScope" ] } )
36
+ services . AddMicrosoftWebAppAuthentication ( Configuration )
37
+ . AddMicrosoftWebAppCallsWebApi ( Configuration , new string [ ] { Configuration [ "TodoList:TodoListScope" ] } )
38
38
. AddInMemoryTokenCaches ( ) ;
39
39
services . AddTodoListService ( Configuration ) ;
40
40
services . AddControllersWithViews ( options =>
Original file line number Diff line number Diff line change 5
5
</PropertyGroup >
6
6
7
7
<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" />
11
11
<PackageReference Include =" Microsoft.VisualStudio.Web.CodeGeneration.Design" Version =" 3.1.3" />
12
12
<PackageReference Include =" Newtonsoft.Json" Version =" 12.0.3" />
13
13
</ItemGroup >
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ public async Task<List<string>> CallGraphApiOnBehalfOfUser()
174
174
}
175
175
catch ( MsalUiRequiredException ex )
176
176
{
177
- _tokenAcquisition . ReplyForbiddenWithWwwAuthenticateHeader ( scopes , ex ) ;
177
+ await _tokenAcquisition . ReplyForbiddenWithWwwAuthenticateHeaderAsync ( scopes , ex ) ;
178
178
throw ( ex ) ;
179
179
}
180
180
}
Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ public void ConfigureServices(IServiceCollection services)
27
27
{
28
28
// Setting configuration for protected web api
29
29
30
- services . AddAuthentication ( JwtBearerDefaults . AuthenticationScheme )
31
- . AddProtectedWebApi ( Configuration ) ;
30
+ services . AddMicrosoftWebApiAuthentication ( Configuration )
31
+ . AddMicrosoftWebApiCallsWebApi ( Configuration )
32
+ . AddInMemoryTokenCaches ( ) ;
32
33
33
34
// Comment above lines of code and uncomment this section if you would like to validate ID tokens for allowed tenantIds
34
35
//services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
@@ -47,10 +48,6 @@ public void ConfigureServices(IServiceCollection services)
47
48
// },
48
49
// options => { Configuration.Bind("AzureAd", options); });
49
50
50
- services . AddProtectedWebApiCallsProtectedWebApi ( Configuration )
51
- . AddInMemoryTokenCaches ( ) ;
52
-
53
- //services.AddProtectedWebApi(Configuration);
54
51
// Creating policies that wraps the authorization requirements
55
52
services . AddAuthorization ( ) ;
56
53
Original file line number Diff line number Diff line change 15
15
<PrivateAssets >all</PrivateAssets >
16
16
<IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
17
17
</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" />
20
20
<PackageReference Include =" Microsoft.VisualStudio.Web.CodeGeneration.Design" Version =" 3.1.3" />
21
21
<PackageReference Include =" Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version =" 3.1.3" Condition =" '$(Configuration)' == 'Debug'" />
22
22
</ItemGroup >
You can’t perform that action at this time.
0 commit comments