Skip to content

Commit bc564d6

Browse files
authored
Jmprieur/sync from web api tutorial (#186)
* Synching the generation of the wwwAuthenticate header in TokenAcquisition.cs from the code which is currently in the ASP.NET Core Web API tutorial * Fix configuration binding in Web API
1 parent e4c0f99 commit bc564d6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: Microsoft.Identity.Web/WebApiServiceCollectionExtensions.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,18 @@ public static IServiceCollection AddProtectedWebApi(
3838
this IServiceCollection services,
3939
IConfiguration configuration,
4040
X509Certificate2 tokenDecryptionCertificate = null,
41-
string configSectionName = "AzureAD",
41+
string configSectionName = "AzureAd",
4242
bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)
4343
{
4444
services.AddAuthentication(AzureADDefaults.JwtBearerAuthenticationScheme)
4545
.AddAzureADBearer(options => configuration.Bind(configSectionName, options));
46+
services.Configure<AzureADOptions>(options => configuration.Bind(configSectionName, options));
4647

4748
services.AddHttpContextAccessor();
4849

4950
// Change the authentication configuration to accommodate the Microsoft identity platform endpoint (v2.0).
5051
services.Configure<JwtBearerOptions>(AzureADDefaults.JwtBearerAuthenticationScheme, options =>
5152
{
52-
// Reinitialize the options as this has changed to JwtBearerOptions to pick configuration values for attributes unique to JwtBearerOptions
53-
configuration.Bind(configSectionName, options);
54-
5553
// This is an Microsoft identity platform Web API
5654
options.Authority += "/v2.0";
5755

0 commit comments

Comments
 (0)