Documentation related to component
AOT support
Please check all that apply
Description of the issue
Prose documentation of the new AOT stuff would be beneficial.
If a user currently has code like:
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi()
.AddMicrosoftGraph()
.AddInMemoryTokenCaches();
It is not hard to figure out that you want to map AddMicrosoftIdentityWebApi to:
var azureAdSection = builder.Configuration.GetSection("AzureAd");
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApiAot(o=>azureAdSection.Bind(o), JwtBearerDefaults.AuthenticationScheme, null);
However, it is a lot less obvious that EnableTokenAcquisitionToCallDownstreamApi should map to either nothing if only OBO calls are needed, or binding ConfidentialClientApplicationOptions with the authentication scheme name, using any method that supports the source generator (one approach of several shown below):
builder.Services.Configure<ConfidentialClientApplicationOptions>(JwtBearerDefaults.AuthenticationScheme, azureAdSection);
It also isn't completely obvious that the calls following EnableTokenAcquisitionToCallDownstreamApi simply get moved to be made on builder.Services instead:
builder.Services
.AddMicrosoftGraph()
.AddInMemoryTokenCaches();
Documentation related to component
AOT support
Please check all that apply
Description of the issue
Prose documentation of the new AOT stuff would be beneficial.
If a user currently has code like:
It is not hard to figure out that you want to map
AddMicrosoftIdentityWebApito:However, it is a lot less obvious that
EnableTokenAcquisitionToCallDownstreamApishould map to either nothing if only OBO calls are needed, or binding ConfidentialClientApplicationOptions with the authentication scheme name, using any method that supports the source generator (one approach of several shown below):It also isn't completely obvious that the calls following
EnableTokenAcquisitionToCallDownstreamApisimply get moved to be made onbuilder.Servicesinstead: