File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66namespace sign_in_webapp . Pages ;
77
8- [ AuthorizeForScopes ( ScopeKeySection = "DownstreamApi :Scopes" ) ]
8+ [ AuthorizeForScopes ( ScopeKeySection = "DownstreamApis:MicrosoftGraph :Scopes" ) ]
99public class IndexModel : PageModel
1010{
1111 private readonly ILogger < IndexModel > _logger ;
@@ -21,7 +21,7 @@ public IndexModel(ILogger<IndexModel> logger,
2121
2222 public async Task OnGet ( )
2323 {
24- using var response = await _downstreamWebApi . CallApiForUserAsync ( "DownstreamApi " ) . ConfigureAwait ( false ) ;
24+ using var response = await _downstreamWebApi . CallApiForUserAsync ( "MicrosoftGraph " ) . ConfigureAwait ( false ) ;
2525 if ( response . StatusCode == System . Net . HttpStatusCode . OK )
2626 {
2727 var apiResult = await response . Content . ReadFromJsonAsync < JsonDocument > ( ) . ConfigureAwait ( false ) ;
Original file line number Diff line number Diff line change 77
88// <ms_docref_add_msal>
99WebApplicationBuilder 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 > > ( ) ;
1111
1212builder . Services . AddMicrosoftIdentityWebAppAuthentication ( builder . Configuration , "AzureAd" )
1313 . EnableTokenAcquisitionToCallDownstreamApi ( initialScopes )
14- . AddDownstreamApi ( "DownstreamApi" , builder . Configuration . GetSection ( "DownstreamApi" ) )
1514 . AddInMemoryTokenCaches ( ) ;
15+ builder . Services . AddDownstreamApis ( builder . Configuration . GetSection ( "DownstreamApis" ) ) ;
16+
1617// </ms_docref_add_msal>
1718
1819// <ms_docref_add_default_controller_for_sign-in-out>
Original file line number Diff line number Diff line change 66 <RootNamespace >sign_in_webapp</RootNamespace >
77 </PropertyGroup >
88 <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" />
1212 </ItemGroup >
1313</Project >
Original file line number Diff line number Diff line change 33 "Instance" : " https://login.microsoftonline.com/" ,
44 "TenantId" : " Enter the tenant ID obtained from the Microsoft Entra admin center" ,
55 "ClientId" : " Enter the client ID obtained from the Microsoft Entra admin center" ,
6- "ClientCertificates " : [
6+ "ClientCredentials " : [
77 {
88 "SourceType" : " StoreWithThumbprint" ,
99 "CertificateStorePath" : " CurrentUser/My" ,
1212 ],
1313 "CallbackPath" : " /signin-oidc"
1414},
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+ }
2123 },
2224 "Logging" : {
2325 "LogLevel" : {
You can’t perform that action at this time.
0 commit comments