Skip to content

Upgrading System.IdentityModel.Tokens.Jwt 5 to 6

Breaking5.7.2 → 6.36.0Breaking4Security7Deprecated2New47Changed49Fixed52Other21

BreakingUpgrade verdict

4 breaking changes and 7 security fixes.

  • Removes the OpenIdConnectMessage(JObject json) constructor, replaced by OpenIdConnectMessage(object json).
  • Removes the JsonWebKeySet(string json, JsonSerializerSettings jsonSerializerSettings) constructor.
  • If you use a symmetric key that is too short for HMAC, the library now throws an error instead of accepting it.
  • Moves TokenValidationResult from Microsoft.IdentityModel.JsonWebTokens to Microsoft.IdentityModel.Tokens.
Top 5 of 13 that need code or config changes

Target frameworks requirement changed in 6.29.0: .NETFramework4.5, .NETFramework4.5.1, .NETFramework4.6.1, .NETStandard1.4, .NETStandard2.0 → .NETFramework4.5, .NETFramework4.6.1, .NETFramework4.6.2, .NETFramework4.7.2, .NETStandard2.0, net6.0.

Breaking4
Removes the OpenIdConnectMessage(JObject json) constructor, replaced by OpenIdConnectMessage(object json).
OpenIdConnectMessage
Removes the JsonWebKeySet(string json, JsonSerializerSettings jsonSerializerSettings) constructor.
JsonWebKeySet
Enforces key sizes when creating HMAC, throwing ArgumentOutOfRangeException if the SymmetricKey is too small.
SymmetricKeyArgumentOutOfRangeException
Moves TokenValidationResult from Microsoft.IdentityModel.JsonWebTokens to Microsoft.IdentityModel.Tokens.
TokenValidationResult
Security7
Updates packages to address CVE-2024-30105.
Fixes security issues detailed in the January 2024 IdentityModel advisories.
Microsoft ASP.NET Core project templates vulnerable to denial of service
Moderate · CVSS 6.8
Sets a maximum depth for Newtonsoft JSON parsing to limit deeply nested payloads.
Validates the size of symmetric signatures.
The signature of the token is no longer logged.
Addresses security bugs (#1656, #1661, #1657).
Deprecated2
Marks SecurityTokenUnableToValidateException as obsolete since the library stopped throwing it in 6.28.0; it will be removed in a future major version.
SecurityTokenUnableToValidateException
Marks an exception that is no longer used as obsolete.