diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b21e82bc..ec51315b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
- TBD
+# 10.0.3
+
+- Added default ctor to JwtHeader and decorated it with `[JsonConstructor]`
+
# 10.0.2
- Disallowed Encode(payload) with AddClaim(s)
diff --git a/JWT.sln b/JWT.sln
index a694636cd..e790a53f0 100644
--- a/JWT.sln
+++ b/JWT.sln
@@ -55,7 +55,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C86A941F-F65
src\Directory.Build.targets = src\Directory.Build.targets
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT.Tests.Net70", "tests\JWT.Tests.Net70\JWT.Tests.Net70.csproj", "{D7F24AC9-D178-4BAB-BF93-4BAD8028416D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWT.Tests.Net70", "tests\JWT.Tests.Net70\JWT.Tests.Net70.csproj", "{D7F24AC9-D178-4BAB-BF93-4BAD8028416D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/JWT/Builder/JwtHeader.cs b/src/JWT/Builder/JwtHeader.cs
index 0d67df5f7..fb41f80a4 100644
--- a/src/JWT/Builder/JwtHeader.cs
+++ b/src/JWT/Builder/JwtHeader.cs
@@ -11,6 +11,12 @@ namespace JWT.Builder
///
public class JwtHeader
{
+#if MODERN_DOTNET
+ [System.Text.Json.Serialization.JsonConstructor]
+ public JwtHeader()
+ {
+ }
+#endif
[JsonProperty("typ")]
#if MODERN_DOTNET
[JsonPropertyName("typ")]
@@ -53,4 +59,4 @@ public class JwtHeader
#endif
public string X5t { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/JWT/JWT.csproj b/src/JWT/JWT.csproj
index 579726def..ef58d7e20 100644
--- a/src/JWT/JWT.csproj
+++ b/src/JWT/JWT.csproj
@@ -20,13 +20,16 @@
Alexander Batishchev, John Sheehan, Michael Lehenbauer
jwt;json;authorization
CC0-1.0
- 10.0.2
- 10.0.0.0
- 10.0.0.0
JWT
true
+
+ 10.0.3
+ 10.0.0.0
+ 10.0.0.0
+
+
$(DefineConstants);TRACE;DEBUG
bin\Debug\
diff --git a/tests/JWT.Tests.Common/Builder/JwtBuilderEncodeTests.cs b/tests/JWT.Tests.Common/Builder/JwtBuilderEncodeTests.cs
index e26a3d804..9a6d16992 100644
--- a/tests/JWT.Tests.Common/Builder/JwtBuilderEncodeTests.cs
+++ b/tests/JWT.Tests.Common/Builder/JwtBuilderEncodeTests.cs
@@ -270,13 +270,6 @@ public void Encode_Should_Throw_NotSupportedException_When_Using_EncodePayload_W
.Throw("because using both Encode(payload) and AddClaims() is not supported");
}
- ///
- /// Copied from: https://stackoverflow.com/a/7077620/2890855
- ///
- ///
- private static bool IsRunningOnMono() =>
- Type.GetType("Mono.Runtime") is not null;
-
[TestMethod]
public void Encode_Should_Return_Token_With_Custom_Extra_Headers_Full_Payload2()
{
diff --git a/tests/JWT.Tests.Common/JwtHeaderTests.cs b/tests/JWT.Tests.Common/JwtHeaderTests.cs
new file mode 100644
index 000000000..a9444723e
--- /dev/null
+++ b/tests/JWT.Tests.Common/JwtHeaderTests.cs
@@ -0,0 +1,30 @@
+using FluentAssertions;
+using JWT.Builder;
+using JWT.Serializers;
+using JWT.Tests.Models;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace JWT.Tests
+{
+ [TestClass]
+ public class JwtHeaderTests
+ {
+ [TestMethod]
+ public void JwtHeader_Should_Be_Serializable()
+ {
+ const string token = TestData.TokenByAsymmetricAlgorithm;
+
+ var serializer = new DefaultJsonSerializerFactory().Create();
+ var urlEncoder = new JwtBase64UrlEncoder();
+ var decoder = new JwtDecoder(serializer, urlEncoder);
+
+ var expected = decoder.DecodeHeader(token);
+ expected.Should().NotBeNull();
+
+ var serializedHeader = serializer.Serialize(expected);
+ var actual = serializer.Deserialize(serializedHeader);
+
+ actual.Should().BeEquivalentTo(expected);
+ }
+ }
+}