-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added default ctor to JwtHeader and decorated it with [JsonConstructo…
…r] (#475) * Bumped version to 10.0.3 * Updated JwtHeader.cs * Updated CHANGELOG.md * Updated JwtHeaderTests.cs * Updated JwtBuilderEncodeTests.cs --------- Co-authored-by: ajaume <[email protected]> Co-authored-by: Alexander Batishchev <[email protected]>
- Loading branch information
1 parent
9b9484f
commit 906002e
Showing
6 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<JwtHeader>(token); | ||
expected.Should().NotBeNull(); | ||
|
||
var serializedHeader = serializer.Serialize(expected); | ||
var actual = serializer.Deserialize<JwtHeader>(serializedHeader); | ||
|
||
actual.Should().BeEquivalentTo(expected); | ||
} | ||
} | ||
} |