-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Description
Description
For the BFF Entra pivot & sample ...
- The sample will hardcode the request transformer scopes.
- The article section on config will call out the manual config.
- The article section on using app settings config will show the app settings and code to draw the scopes from configuration.
app.MapForwarder("/weather-forecast", "https://weatherapi", transformBuilder =>
{
transformBuilder.AddRequestTransform(async transformContext =>
{
var tokenAcquisition = transformContext.HttpContext.RequestServices.GetRequiredService<ITokenAcquisition>();
List<string> scopes = ["{APP ID URI}/Weather.Get"];
var accessToken = await tokenAcquisition.GetAccessTokenForUserAsync(scopes);
transformContext.ProxyRequest.Headers.Authorization = new("Bearer", accessToken);
});
}).RequireAuthorization();var configuration = transformContext.HttpContext.RequestServices.GetRequiredService<IConfiguration>();
var scopes = configuration.GetSection("DownstreamApi:Scopes").Get<IEnumerable<string>>();
var accessToken = await tokenAcquisition.GetAccessTokenForUserAsync(scopes ??
throw new IOException("No downstream API scopes!"));"DownstreamApi": {
"BaseUrl": "{BASE URL}",
"Scopes": [ "{APP ID URI}/Weather.Get" ]
}Page URL
Content source URL
Document ID
58758d13-94c9-e208-e0f6-16676834413c
Platform Id
1c89a093-14c3-881b-7297-49c7c6cb4ea1
Article author
Metadata
- ID: 58758d13-94c9-e208-e0f6-16676834413c
- PlatformId: 1c89a093-14c3-881b-7297-49c7c6cb4ea1
- Service: aspnet-core
- Sub-service: blazor
Metadata
Metadata
Assignees
Type
Projects
Status
Done