Skip to content

Commit

Permalink
update jwtBearer package to 5.0.12-*
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyf19 committed Nov 18, 2021
1 parent aa5b443 commit a0095b4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/Microsoft.Identity.Web/MergedOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public ConfidentialClientApplicationOptions ConfidentialClientApplicationOptions
public LogLevel LogLevel { get; set; }
public string? RedirectUri { get; set; }
public bool EnableCacheSynchronization { get; set; }
internal bool MergedWithCca { get; set; }

internal static void UpdateMergedOptionsFromMicrosoftIdentityOptions(MicrosoftIdentityOptions microsoftIdentityOptions, MergedOptions mergedOptions)
{
Expand Down Expand Up @@ -254,6 +255,7 @@ internal static void UpdateMergedOptionsFromMicrosoftIdentityOptions(MicrosoftId

internal static void UpdateMergedOptionsFromConfidentialClientApplicationOptions(ConfidentialClientApplicationOptions confidentialClientApplicationOptions, MergedOptions mergedOptions)
{
mergedOptions.MergedWithCca = true;
mergedOptions.AadAuthorityAudience = confidentialClientApplicationOptions.AadAuthorityAudience;
mergedOptions.AzureCloudInstance = confidentialClientApplicationOptions.AzureCloudInstance;
if (string.IsNullOrEmpty(mergedOptions.AzureRegion) && !string.IsNullOrEmpty(confidentialClientApplicationOptions.AzureRegion))
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.12-*" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.12-*" />
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="$(IdentityModelVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(IdentityModelVersion)" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(IdentityModelVersion)" />
Expand Down
14 changes: 11 additions & 3 deletions src/Microsoft.Identity.Web/TokenAcquisition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ public TokenAcquisition(

internal MergedOptions GetOptions(string authenticationScheme)
{
return _mergedOptionsMonitor.Get(authenticationScheme);
var mergedOptions = _mergedOptionsMonitor.Get(authenticationScheme);
if (!mergedOptions.MergedWithCca)
{
var ccaOptionsMonitor = _serviceProvider.GetService<IOptionsMonitor<ConfidentialClientApplicationOptions>>();
ccaOptionsMonitor?.Get(authenticationScheme);
}

return mergedOptions;
}

/// <summary>
Expand Down Expand Up @@ -363,13 +370,14 @@ public Task<AuthenticationResult> GetAuthenticationResultForAppAsync(
}

authenticationScheme = GetEffectiveAuthenticationScheme(authenticationScheme);

MergedOptions mergedOptions = GetOptions(authenticationScheme);

// Case of an anonymous controller, no [Authorize] attribute will trigger the merge options
if (string.IsNullOrEmpty(mergedOptions.Instance))
{
var mergedOptionsMonitor = _serviceProvider.GetRequiredService<IOptionsMonitor<JwtBearerOptions>>();
mergedOptionsMonitor.Get(JwtBearerDefaults.AuthenticationScheme);
var mergedOptionsMonitor = _serviceProvider.GetService<IOptionsMonitor<JwtBearerOptions>>();
mergedOptionsMonitor?.Get(JwtBearerDefaults.AuthenticationScheme);
}

if (string.IsNullOrEmpty(tenant))
Expand Down
2 changes: 1 addition & 1 deletion tests/WebAppCallsWebApiCallsGraph/gRPC/grpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.32.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.12-*" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit a0095b4

Please sign in to comment.