File tree 4 files changed +17
-14
lines changed
4 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 5
5
6
6
namespace sign_in_webapp . Pages ;
7
7
8
- [ AuthorizeForScopes ( ScopeKeySection = "DownstreamApi :Scopes" ) ]
8
+ [ AuthorizeForScopes ( ScopeKeySection = "DownstreamApis:MicrosoftGraph :Scopes" ) ]
9
9
public class IndexModel : PageModel
10
10
{
11
11
private readonly ILogger < IndexModel > _logger ;
@@ -21,7 +21,7 @@ public IndexModel(ILogger<IndexModel> logger,
21
21
22
22
public async Task OnGet ( )
23
23
{
24
- using var response = await _downstreamWebApi . CallApiForUserAsync ( "DownstreamApi " ) . ConfigureAwait ( false ) ;
24
+ using var response = await _downstreamWebApi . CallApiForUserAsync ( "MicrosoftGraph " ) . ConfigureAwait ( false ) ;
25
25
if ( response . StatusCode == System . Net . HttpStatusCode . OK )
26
26
{
27
27
var apiResult = await response . Content . ReadFromJsonAsync < JsonDocument > ( ) . ConfigureAwait ( false ) ;
Original file line number Diff line number Diff line change 7
7
8
8
// <ms_docref_add_msal>
9
9
WebApplicationBuilder builder = WebApplication . CreateBuilder ( args ) ;
10
- IEnumerable < string > ? initialScopes = builder . Configuration . GetSection ( "DownstreamApi :Scopes" ) . Get < IEnumerable < string > > ( ) ;
10
+ IEnumerable < string > ? initialScopes = builder . Configuration . GetSection ( "DownstreamApis:MicrosoftGraph :Scopes" ) . Get < IEnumerable < string > > ( ) ;
11
11
12
12
builder . Services . AddMicrosoftIdentityWebAppAuthentication ( builder . Configuration , "AzureAd" )
13
13
. EnableTokenAcquisitionToCallDownstreamApi ( initialScopes )
14
- . AddDownstreamApi ( "DownstreamApi" , builder . Configuration . GetSection ( "DownstreamApi" ) )
15
14
. AddInMemoryTokenCaches ( ) ;
15
+ builder . Services . AddDownstreamApis ( builder . Configuration . GetSection ( "DownstreamApis" ) ) ;
16
+
16
17
// </ms_docref_add_msal>
17
18
18
19
// <ms_docref_add_default_controller_for_sign-in-out>
Original file line number Diff line number Diff line change 6
6
<RootNamespace >sign_in_webapp</RootNamespace >
7
7
</PropertyGroup >
8
8
<ItemGroup >
9
- <PackageReference Include =" Microsoft.Identity.Web" Version =" 3.5 .0" />
10
- <PackageReference Include =" Microsoft.Identity.Web.UI" Version =" 3.5 .0" />
11
- <PackageReference Include =" Microsoft.Identity.Web.DownstreamApi" Version =" 3.5 .0" />
9
+ <PackageReference Include =" Microsoft.Identity.Web" Version =" 3.8 .0" />
10
+ <PackageReference Include =" Microsoft.Identity.Web.UI" Version =" 3.8 .0" />
11
+ <PackageReference Include =" Microsoft.Identity.Web.DownstreamApi" Version =" 3.8 .0" />
12
12
</ItemGroup >
13
13
</Project >
Original file line number Diff line number Diff line change 3
3
"Instance" : " https://login.microsoftonline.com/" ,
4
4
"TenantId" : " Enter the tenant ID obtained from the Microsoft Entra admin center" ,
5
5
"ClientId" : " Enter the client ID obtained from the Microsoft Entra admin center" ,
6
- "ClientCertificates " : [
6
+ "ClientCredentials " : [
7
7
{
8
8
"SourceType" : " StoreWithThumbprint" ,
9
9
"CertificateStorePath" : " CurrentUser/My" ,
12
12
],
13
13
"CallbackPath" : " /signin-oidc"
14
14
},
15
- "DownstreamApi" : {
16
- "BaseUrl" : " https://graph.microsoft.com/v1.0/" ,
17
- "RelativePath" : " me" ,
18
- "Scopes" : [
19
- " user.read"
20
- ]
15
+ "DownstreamApis" : {
16
+ "MicrosoftGraph" :{
17
+ "BaseUrl" : " https://graph.microsoft.com/v1.0/" ,
18
+ "RelativePath" : " me" ,
19
+ "Scopes" : [
20
+ " user.read"
21
+ ]
22
+ }
21
23
},
22
24
"Logging" : {
23
25
"LogLevel" : {
You can’t perform that action at this time.
0 commit comments