-
Notifications
You must be signed in to change notification settings - Fork 254
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Documentation related to component
AOT support
Please check all that apply
- typo
- documentation doesn't exist
- documentation needs clarification
- error(s) in the example
- needs an example
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();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation