Skip to content

Commit

Permalink
Fix 3167 (package downgrade when referencing IdentityModel.Tokens fro…
Browse files Browse the repository at this point in the history
…m dev) (#3168)

* Fix 3167

* Fixing in standalone and with new Wilson dev

* Update references to non-obsolete

* Fix test failing du to change in reference of Microsoft.Extensions.Cache.Memory to 6.x (because of obsolete version 5,x)

* Address PR feedback
  • Loading branch information
jmprieur authored Dec 16, 2024
1 parent bb7c3e8 commit 9417313
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,21 @@
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<MicrosoftAspNetCoreAuthenticationJwtBearerVersion>5.0.12-*</MicrosoftAspNetCoreAuthenticationJwtBearerVersion>
<MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion>5.0.12-*</MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion>
<MicrosoftExtensionsCachingMemoryVersion>5.0.0</MicrosoftExtensionsCachingMemoryVersion>
<!-- Microsoft.Extensions.Hosting 5.* are obsoleted -->
<MicrosoftAspNetCoreAuthenticationJwtBearerVersion>6.0.0-*</MicrosoftAspNetCoreAuthenticationJwtBearerVersion>
<MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion>6.0.0-*</MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion>
<MicrosoftExtensionsCachingMemoryVersion>6.0.2</MicrosoftExtensionsCachingMemoryVersion>
<!-- Microsoft.Extensions.* 5.* are obsoleted -->
<MicrosoftExtensionsHostingVersion>6.0.0</MicrosoftExtensionsHostingVersion>
<MicrosoftAspNetCoreDataProtectionVersion>5.0.8</MicrosoftAspNetCoreDataProtectionVersion>
<MicrosoftAspNetCoreDataProtectionVersion>6.0.0</MicrosoftAspNetCoreDataProtectionVersion>
<SystemSecurityCryptographyPkcsVersion>7.0.2</SystemSecurityCryptographyPkcsVersion>
<SystemSecurityCryptographyXmlVersion>6.0.1</SystemSecurityCryptographyXmlVersion>

<!-- CVE-2022-34716 due to DataProtection 5.0.8 -->
<MicrosoftExtensionsLoggingVersion>5.0.0</MicrosoftExtensionsLoggingVersion>
<SystemTextEncodingsWebVersion>6.0.0</SystemTextEncodingsWebVersion>

<!-- 6.0.0 as 5.x are deprecated -->
<MicrosoftExtensionsLoggingVersion>6.0.0</MicrosoftExtensionsLoggingVersion>

<!-- Microsoft.Extensions.Configuration.Binder 6.* are obsoleted -->
<MicrosoftExtensionsConfigurationBinderVersion>6.0.0</MicrosoftExtensionsConfigurationBinderVersion>
<MicrosoftExtensionsDependencyInjectionVersion>2.1.0</MicrosoftExtensionsDependencyInjectionVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="$(AzureSecurityKeyVaultSecretsVersion)" />
<PackageReference Include="Azure.Identity" Version="$(AzureIdentityVersion)" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="$(AzureSecurityKeyVaultCertificatesVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingVersion)" />
<PackageReference Include="Microsoft.Identity.Abstractions" Version="$(MicrosoftIdentityAbstractionsVersion)" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task EncryptionTestAsync(bool isEncrypted)
private byte[] GetFirstCacheValue(MemoryCache memoryCache)
{
IDictionary memoryCacheContent;
# if NET6_0
# if NET6_0 || NET462
memoryCacheContent = (memoryCache
.GetType()
.GetProperty("StringKeyEntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
Expand Down Expand Up @@ -88,7 +88,7 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache)
.GetType()
.GetField("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
.GetValue(_testCacheAdapter!._memoryCache) as IDictionary)!;
#endif
#endif // NET472
var firstEntry = memoryCacheContent.Values.OfType<object>().First();
var firstEntryValue = firstEntry.GetType()
.GetProperty("Value")!
Expand Down

0 comments on commit 9417313

Please sign in to comment.