diff --git a/JWT.nuspec b/JWT.nuspec
deleted file mode 100644
index fb422c6cb..000000000
--- a/JWT.nuspec
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- JWT
- 2.3.1
- John Sheehan, Michael Lehenbauer, Alexander Batishchev
- johnsheehan, devinrader, abatishchev
- Jwt.Net, a JWT (JSON Web Token) implementation for .NET
- Public Domain
- en-US
- https://github.com/jwt-dotnet/jwt
- https://creativecommons.org/publicdomain/zero/1.0/
- jwt json
-
-
-
-
-
diff --git a/JWT.sln b/JWT.sln
index 208260a4b..90e234065 100644
--- a/JWT.sln
+++ b/JWT.sln
@@ -1,35 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT", "src\JWT\JWT.csproj", "{A80B51B8-DDF6-4026-98A4-B59653E50B38}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT.Tests", "tests\JWT.Tests\JWT.Tests.csproj", "{BF568781-D576-4545-A552-4DC839B1AF14}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{513CE2B5-E0D6-43BC-998A-A02CB2875479}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
- JWT.nuspec = JWT.nuspec
- package.cmd = package.cmd
README.md = README.md
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT", "src\JWT\JWT.csproj", "{2F79EB8D-5B33-4EA6-AC1A-89B107F043D2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWT.Tests.Core", "tests\JWT.Tests.Core\JWT.Tests.Core.csproj", "{79341F14-151C-4231-B2A7-56DAC44CB25E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT.Tests.NETFramework", "tests\JWT.Tests.NETFramework\JWT.Tests.NETFramework.csproj", "{88E1DB97-3507-4D8C-9B3D-715DE2F9E414}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWT.Tests.Common", "tests\JWT.Tests.Common\JWT.Tests.Common.csproj", "{5D0282D5-9CC4-4D42-A3F0-E18270F92184}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A80B51B8-DDF6-4026-98A4-B59653E50B38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A80B51B8-DDF6-4026-98A4-B59653E50B38}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A80B51B8-DDF6-4026-98A4-B59653E50B38}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A80B51B8-DDF6-4026-98A4-B59653E50B38}.Release|Any CPU.Build.0 = Release|Any CPU
- {BF568781-D576-4545-A552-4DC839B1AF14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BF568781-D576-4545-A552-4DC839B1AF14}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BF568781-D576-4545-A552-4DC839B1AF14}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BF568781-D576-4545-A552-4DC839B1AF14}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2F79EB8D-5B33-4EA6-AC1A-89B107F043D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2F79EB8D-5B33-4EA6-AC1A-89B107F043D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2F79EB8D-5B33-4EA6-AC1A-89B107F043D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2F79EB8D-5B33-4EA6-AC1A-89B107F043D2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {79341F14-151C-4231-B2A7-56DAC44CB25E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {79341F14-151C-4231-B2A7-56DAC44CB25E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {79341F14-151C-4231-B2A7-56DAC44CB25E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {79341F14-151C-4231-B2A7-56DAC44CB25E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {88E1DB97-3507-4D8C-9B3D-715DE2F9E414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {88E1DB97-3507-4D8C-9B3D-715DE2F9E414}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {88E1DB97-3507-4D8C-9B3D-715DE2F9E414}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {88E1DB97-3507-4D8C-9B3D-715DE2F9E414}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5D0282D5-9CC4-4D42-A3F0-E18270F92184}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5D0282D5-9CC4-4D42-A3F0-E18270F92184}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5D0282D5-9CC4-4D42-A3F0-E18270F92184}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5D0282D5-9CC4-4D42-A3F0-E18270F92184}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/package.cmd b/package.cmd
deleted file mode 100644
index e761f0f7b..000000000
--- a/package.cmd
+++ /dev/null
@@ -1,11 +0,0 @@
-tools\nuget.exe update -self
-
-if not exist package mkdir package
-if not exist package mkdir package
-if not exist package\lib mkdir package\lib
-if not exist package\lib\net45 mkdir package\lib\net45
-
-msbuild src\JWT.sln -p:Configuration=Release
-copy src\JWT\bin\Release\JWT.dll package\lib\net45
-
-tools\nuget.exe pack JWT.nuspec -BasePath package
diff --git a/src/JWT/Algorithms/RS256Algorithm.cs b/src/JWT/Algorithms/RS256Algorithm.cs
index aaf901031..b33177ee0 100644
--- a/src/JWT/Algorithms/RS256Algorithm.cs
+++ b/src/JWT/Algorithms/RS256Algorithm.cs
@@ -14,7 +14,11 @@ public RS256Algorithm(X509Certificate2 cert)
public byte[] Sign(byte[] key, byte[] bytesToSign)
{
+#if NETSTANDARD1_3
+ var rsa = (RSACryptoServiceProvider)_cert.GetRSAPrivateKey();
+#else
var rsa = (RSACryptoServiceProvider)_cert.PrivateKey;
+#endif
var param = new CspParameters
{
KeyContainerName = rsa.CspKeyContainerInfo.KeyContainerName,
diff --git a/src/JWT/JWT.csproj b/src/JWT/JWT.csproj
index 42bec086c..40f5457e8 100644
--- a/src/JWT/JWT.csproj
+++ b/src/JWT/JWT.csproj
@@ -1,74 +1,40 @@
-
-
+
+
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {A80B51B8-DDF6-4026-98A4-B59653E50B38}
- Library
- Properties
- JWT
- JWT
- v3.5
- 512
-
-
+ net35;netstandard1.3
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
+
+ .NETFramework
+ NET35
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
+
+ .NETStandard
+ NETSTANDARD1_3
+
+
+ Public Domain
+ Public Domain
+ JWT.NET, a JWT (JSON Web Token) implementation for .NET
+ https://github.com/jwt-dotnet/jwt
+ https://github.com/jwt-dotnet/jwt
+ John Sheehan, Michael Lehenbauer, Alexander Batishchev
+ https://creativecommons.org/publicdomain/zero/1.0/
+ 3.0.0-beta1
+ jwt json
+
+
+
+ TRACE;DEBUG
+ bin\Debug\netstandard1.3\JWT.xml
+ bin\Debug\netstandard1.3\
+
+
-
- ..\..\packages\Newtonsoft.Json.10.0.2\lib\net35\Newtonsoft.Json.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
-
\ No newline at end of file
diff --git a/src/JWT/Properties/AssemblyInfo.cs b/src/JWT/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2a1c29449..000000000
--- a/src/JWT/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("JWT")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Public Domain")]
-[assembly: AssemblyProduct("JWT")]
-[assembly: AssemblyCopyright("Public Domain")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("745e649e-588d-4e6d-81ce-1d2c39c24b0a")]
-
-[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.0.0")]
diff --git a/src/JWT/packages.config b/src/JWT/packages.config
deleted file mode 100644
index 1c2dd1d2f..000000000
--- a/src/JWT/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/tests/JWT.Tests/Internal/Customer.cs b/tests/JWT.Tests.Common/Customer.cs
similarity index 62%
rename from tests/JWT.Tests/Internal/Customer.cs
rename to tests/JWT.Tests.Common/Customer.cs
index 962512af8..b5310f38f 100644
--- a/tests/JWT.Tests/Internal/Customer.cs
+++ b/tests/JWT.Tests.Common/Customer.cs
@@ -1,9 +1,9 @@
-namespace JWT.Tests
-{
- internal class Customer
- {
- public string FirstName { get; set; }
-
- public int Age { get; set; }
- }
+namespace JWT.Tests.Common
+{
+ public class Customer
+ {
+ public string FirstName { get; set; }
+
+ public int Age { get; set; }
+ }
}
\ No newline at end of file
diff --git a/tests/JWT.Tests.Common/JWT.Tests.Common.csproj b/tests/JWT.Tests.Common/JWT.Tests.Common.csproj
new file mode 100644
index 000000000..15367752a
--- /dev/null
+++ b/tests/JWT.Tests.Common/JWT.Tests.Common.csproj
@@ -0,0 +1,7 @@
+
+
+
+ netstandard1.0
+
+
+
\ No newline at end of file
diff --git a/tests/JWT.Tests.Common/TestData.cs b/tests/JWT.Tests.Common/TestData.cs
new file mode 100644
index 000000000..ced7c196a
--- /dev/null
+++ b/tests/JWT.Tests.Common/TestData.cs
@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+
+namespace JWT.Tests.Common
+{
+ public static class TestData
+ {
+ public static readonly Customer Customer = new Customer { FirstName = "Bob", Age = 37 };
+
+ public const string Token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
+ public const string MalformedToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
+ public const string ExtraHeadersToken = "eyJmb28iOiJiYXIiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.slrbXF9VSrlX7LKsV-Umb_zEzWLxQjCfUOjNTbvyr1g";
+
+ public static readonly IDictionary DictionaryPayload = new Dictionary
+ {
+ { "FirstName", "Bob" },
+ { "Age", 37 }
+ };
+ }
+}
diff --git a/tests/JWT.Tests.Core/DecodeTests.cs b/tests/JWT.Tests.Core/DecodeTests.cs
new file mode 100644
index 000000000..d55078208
--- /dev/null
+++ b/tests/JWT.Tests.Core/DecodeTests.cs
@@ -0,0 +1,101 @@
+using System;
+using FluentAssertions;
+using JWT.Serializers;
+using Xunit;
+using JWT.Tests.Common;
+
+namespace JWT.Tests
+{
+ public class DecodeTests
+ {
+ [Fact]
+ public void Decode_Should_DecodeToken_To_Json_Encoded_String_With_JsonNet_Serializer()
+ {
+ var serializer = new JsonNetSerializer();
+ JsonWebToken.JsonSerializer = serializer;
+
+ var expectedPayload = serializer.Serialize(TestData.Customer);
+ var actualPayload = JsonWebToken.Decode(TestData.Token, "ABC", verify: false);
+
+ actualPayload.Should().Be(expectedPayload);
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_DecodeToken_To_Dictionary_With_JsonNet_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new JsonNetSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.DictionaryPayload, options => options.IncludingAllRuntimeProperties());
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_DecodeToken_To_Generic_Type_With_JsonNet_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new JsonNetSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.Customer);
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Throw_Exception_On_MalformedToken()
+ {
+ Action action = () => JsonWebToken.DecodeToObject(TestData.MalformedToken, "ABC", verify: false);
+
+ action.ShouldThrow();
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Throw_Exception_On_Invalid_Key()
+ {
+ Action action = () => JsonWebToken.DecodeToObject(TestData.Token, "XYZ", verify: true);
+
+ action.ShouldThrow();
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Throw_Exception_On_Invalid_Expiration_Claim()
+ {
+ var invalidexptoken = JsonWebToken.Encode(new { exp = "asdsad" }, "ABC", JwtHashAlgorithm.HS256);
+
+ Action action = () => JsonWebToken.DecodeToObject(invalidexptoken, "ABC", verify: true);
+
+ action.ShouldThrow();
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Throw_Exception_On_Expired_Claim()
+ {
+ var hourAgo = DateTime.UtcNow.Subtract(new TimeSpan(1, 0, 0));
+ var unixTimestamp = (int)(hourAgo - new DateTime(1970, 1, 1)).TotalSeconds;
+ var expiredtoken = JsonWebToken.Encode(new { exp = unixTimestamp }, "ABC", JwtHashAlgorithm.HS256);
+
+ Action action = () => JsonWebToken.DecodeToObject(expiredtoken, "ABC", verify: true);
+
+ action.ShouldThrow();
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Throw_Exception_Before_NotBefore_Becomes_Valid()
+ {
+ var nbf = (int)(DateTime.UtcNow.AddHours(1) - JwtValidator.UnixEpoch).TotalSeconds;
+ var invalidnbftoken = JsonWebToken.Encode(new { nbf = nbf }, "ABC", JwtHashAlgorithm.HS256);
+
+ Action action = () => JsonWebToken.DecodeToObject(invalidnbftoken, "ABC", verify: true);
+
+ action.ShouldThrow();
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Decode_Token_After_NotBefore_Becomes_Valid()
+ {
+ var nbf = (int)(DateTime.UtcNow - JwtValidator.UnixEpoch).TotalSeconds;
+ var validnbftoken = JsonWebToken.Encode(new { nbf = nbf }, "ABC", JwtHashAlgorithm.HS256);
+
+ JsonWebToken.DecodeToObject(validnbftoken, "ABC", verify: true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/JWT.Tests.Core/EncodeTests.cs b/tests/JWT.Tests.Core/EncodeTests.cs
new file mode 100644
index 000000000..1f685182f
--- /dev/null
+++ b/tests/JWT.Tests.Core/EncodeTests.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using FluentAssertions;
+using JWT.Serializers;
+using Xunit;
+using JWT.Tests.Common;
+
+namespace JWT.Tests
+{
+ public class EncodeTests
+ {
+ [Fact]
+ public void Should_Encode_Type_With_JsonNet_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new JsonNetSerializer();
+
+ var actual = JsonWebToken.Encode(TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.Token);
+ }
+
+ [Fact]
+ public void Should_Encode_Type_With_JsonNet_Serializer_And_Extra_Headers()
+ {
+ JsonWebToken.JsonSerializer = new JsonNetSerializer();
+
+ var extraheaders = new Dictionary { { "foo", "bar" } };
+ var actual = JsonWebToken.Encode(extraheaders, TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.ExtraHeadersToken);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/JWT.Tests.Core/JWT.Tests.Core.csproj b/tests/JWT.Tests.Core/JWT.Tests.Core.csproj
new file mode 100644
index 000000000..43463ae64
--- /dev/null
+++ b/tests/JWT.Tests.Core/JWT.Tests.Core.csproj
@@ -0,0 +1,23 @@
+
+
+
+ netcoreapp1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/JWT.Tests/JwtDecoderTest.cs b/tests/JWT.Tests.Core/JwtDecoderTest.cs
similarity index 80%
rename from tests/JWT.Tests/JwtDecoderTest.cs
rename to tests/JWT.Tests.Core/JwtDecoderTest.cs
index ba6bc9018..232577f33 100644
--- a/tests/JWT.Tests/JwtDecoderTest.cs
+++ b/tests/JWT.Tests.Core/JwtDecoderTest.cs
@@ -1,25 +1,14 @@
-using System;
-using System.Collections.Generic;
+using System;
using FluentAssertions;
using JWT.Algorithms;
using JWT.Serializers;
using Xunit;
+using JWT.Tests.Common;
namespace JWT.Tests
{
public class JwtDecoderTest
{
- private static readonly Customer _customer = new Customer { FirstName = "Bob", Age = 37 };
-
- private const string _token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
- private const string _malformedtoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
-
- private static readonly IDictionary _dictionaryPayload = new Dictionary
- {
- { "FirstName", "Bob" },
- { "Age", 37 }
- };
-
[Fact]
public void Decode_Should_Decode_Token_To_Json_Encoded_String()
{
@@ -27,9 +16,9 @@ public void Decode_Should_Decode_Token_To_Json_Encoded_String()
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, null, urlEncoder);
- var expectedPayload = serializer.Serialize(_customer);
+ var expectedPayload = serializer.Serialize(TestData.Customer);
- var actualPayload = decoder.Decode(_token, "ABC", verify: false);
+ var actualPayload = decoder.Decode(TestData.Token, "ABC", verify: false);
actualPayload.Should().Be(expectedPayload);
}
@@ -41,9 +30,9 @@ public void DecodeToObject_Should_Decode_Token_To_Dictionary()
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, null, urlEncoder);
- var actualPayload = decoder.DecodeToObject(_token, "ABC", verify: false);
+ var actualPayload = decoder.DecodeToObject(TestData.Token, "ABC", verify: false);
- actualPayload.ShouldBeEquivalentTo(_dictionaryPayload, options => options.IncludingAllRuntimeProperties());
+ actualPayload.ShouldBeEquivalentTo(TestData.DictionaryPayload, options => options.IncludingAllRuntimeProperties());
}
[Fact]
@@ -53,9 +42,9 @@ public void DecodeToObject_Should_Decode_Token_To_Generic_Type()
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, null, urlEncoder);
- var actualPayload = decoder.DecodeToObject(_token, "ABC", verify: false);
+ var actualPayload = decoder.DecodeToObject(TestData.Token, "ABC", verify: false);
- actualPayload.ShouldBeEquivalentTo(_customer);
+ actualPayload.ShouldBeEquivalentTo(TestData.Customer);
}
[Fact]
@@ -65,7 +54,7 @@ public void DecodeToObject_Should_Throw_Exception_On_Malformed_Token()
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, null, urlEncoder);
- Action action = () => decoder.DecodeToObject(_malformedtoken, "ABC", verify: false);
+ Action action = () => decoder.DecodeToObject(TestData.MalformedToken, "ABC", verify: false);
action.ShouldThrow();
}
@@ -78,7 +67,7 @@ public void DecodeToObject_Should_Throw_Exception_On_Invalid_Key()
var urlEncoder = new JwtBase64UrlEncoder();
var decoder = new JwtDecoder(serializer, validator, urlEncoder);
- Action action = () => decoder.DecodeToObject(_token, "XYZ", verify: true);
+ Action action = () => decoder.DecodeToObject(TestData.Token, "XYZ", verify: true);
action.ShouldThrow();
}
diff --git a/tests/JWT.Tests/JwtEncoderTest.cs b/tests/JWT.Tests.Core/JwtEncoderTest.cs
similarity index 52%
rename from tests/JWT.Tests/JwtEncoderTest.cs
rename to tests/JWT.Tests.Core/JwtEncoderTest.cs
index 4b4bbfdbb..2cf6f4f64 100644
--- a/tests/JWT.Tests/JwtEncoderTest.cs
+++ b/tests/JWT.Tests.Core/JwtEncoderTest.cs
@@ -1,18 +1,14 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using FluentAssertions;
using JWT.Algorithms;
using JWT.Serializers;
using Xunit;
+using JWT.Tests.Common;
namespace JWT.Tests
{
public class JwtEncoderTest
{
- private static readonly Customer _customer = new Customer { FirstName = "Bob", Age = 37 };
-
- private const string _token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
- private const string _extraheaderstoken = "eyJmb28iOiJiYXIiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.slrbXF9VSrlX7LKsV-Umb_zEzWLxQjCfUOjNTbvyr1g";
-
[Fact]
public void Encode_Should_Encode_To_Token()
{
@@ -20,9 +16,9 @@ public void Encode_Should_Encode_To_Token()
var urlEncoder = new JwtBase64UrlEncoder();
var encoder = new JwtEncoder(new HMACSHA256Algorithm(), serializer, urlEncoder);
- var actual = encoder.Encode(_customer, "ABC");
+ var actual = encoder.Encode(TestData.Customer, "ABC");
- actual.Should().Be(_token);
+ actual.Should().Be(TestData.Token);
}
[Fact]
@@ -33,9 +29,9 @@ public void Encode_Should_Encode_To_Token_With_Extra_Headers()
var encoder = new JwtEncoder(new HMACSHA256Algorithm(), serializer, urlEncoder);
var extraheaders = new Dictionary { { "foo", "bar" } };
- var actual = encoder.Encode(extraheaders, _customer, "ABC");
+ var actual = encoder.Encode(extraheaders, TestData.Customer, "ABC");
- actual.Should().Be(_extraheaderstoken);
+ actual.Should().Be(TestData.ExtraHeadersToken);
}
}
}
\ No newline at end of file
diff --git a/tests/JWT.Tests.NETFramework/DecodeTests.cs b/tests/JWT.Tests.NETFramework/DecodeTests.cs
new file mode 100644
index 000000000..879ce9aae
--- /dev/null
+++ b/tests/JWT.Tests.NETFramework/DecodeTests.cs
@@ -0,0 +1,78 @@
+using FluentAssertions;
+using JWT.Tests.Common;
+using JWT.Tests.NETFramework.Serializers;
+using Xunit;
+
+namespace JWT.Tests.NETFramework
+{
+ public class DecodeTests
+ {
+ [Fact]
+ public void Decode_Should_Decode_Token_To_Json_Encoded_String_With_WebScript_Serializer()
+ {
+ var serializer = new WebScriptJsonSerializer();
+ JsonWebToken.JsonSerializer = serializer;
+
+ var expectedPayload = serializer.Serialize(TestData.Customer);
+
+ var actualPayload = JsonWebToken.Decode(TestData.Token, "ABC", verify: false);
+
+ actualPayload.Should().Be(expectedPayload);
+ }
+
+ [Fact]
+ public void Decode_Should_Decode_Token_To_Json_Encoded_String_With_ServiceStack_Serializer()
+ {
+ var serializer = new ServiceStackJsonSerializer();
+ JsonWebToken.JsonSerializer = serializer;
+
+ var expectedPayload = serializer.Serialize(TestData.Customer);
+
+ var actualPayload = JsonWebToken.Decode(TestData.Token, "ABC", verify: false);
+
+ actualPayload.Should().Be(expectedPayload);
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Decode_Token_To_Dictionary_With_WebScript_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.DictionaryPayload, options => options.IncludingAllRuntimeProperties());
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Decode_Token_To_Dictionary_With_ServiceStack_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.DictionaryPayload, options => options.IncludingAllRuntimeProperties());
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Decode_Token_To_Generic_Type_With_WebScript_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.Customer);
+ }
+
+ [Fact]
+ public void DecodeToObject_Should_Decode_Token_To_Generic_Type_With_ServiceStack_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
+
+ var actualPayload = JsonWebToken.DecodeToObject(TestData.Token, "ABC", verify: false);
+
+ actualPayload.ShouldBeEquivalentTo(TestData.Customer);
+ }
+
+
+ }
+}
diff --git a/tests/JWT.Tests.NETFramework/EncodeTests.cs b/tests/JWT.Tests.NETFramework/EncodeTests.cs
new file mode 100644
index 000000000..49e757f9e
--- /dev/null
+++ b/tests/JWT.Tests.NETFramework/EncodeTests.cs
@@ -0,0 +1,54 @@
+using FluentAssertions;
+using JWT.Tests.Common;
+using JWT.Tests.NETFramework.Serializers;
+using System.Collections.Generic;
+using Xunit;
+
+namespace JWT.Tests.NETFramework
+{
+ public class EncodeTests
+ {
+ [Fact]
+ public void Should_Encode_Type_With_WebScript_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
+
+ var actual = JsonWebToken.Encode(TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.Token);
+ }
+
+ [Fact]
+ public void Should_Encode_Type_With_WebScript_Serializer_And_Extra_Headers()
+ {
+ JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
+
+ var extraheaders = new Dictionary { { "foo", "bar" } };
+ var actual = JsonWebToken.Encode(extraheaders, TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.ExtraHeadersToken);
+ }
+
+ [Fact]
+ public void Should_Encode_Type_With_ServiceStack_Serializer()
+ {
+ JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
+
+ var actual = JsonWebToken.Encode(TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.Token);
+ }
+
+ [Fact]
+ public void Should_Encode_Type_With_ServiceStack_Serializer_And_Extra_Headers()
+ {
+ JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
+
+ var extraheaders = new Dictionary { { "foo", "bar" } };
+ var actual = JsonWebToken.Encode(extraheaders, TestData.Customer, "ABC", JwtHashAlgorithm.HS256);
+
+ actual.Should().Be(TestData.ExtraHeadersToken);
+ }
+
+ }
+}
diff --git a/tests/JWT.Tests/JWT.Tests.csproj b/tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj
similarity index 65%
rename from tests/JWT.Tests/JWT.Tests.csproj
rename to tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj
index 0f35d031d..a6d98aa74 100644
--- a/tests/JWT.Tests/JWT.Tests.csproj
+++ b/tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj
@@ -1,20 +1,20 @@
-
-
-
+
+
Debug
AnyCPU
- {BF568781-D576-4545-A552-4DC839B1AF14}
+ {88E1DB97-3507-4D8C-9B3D-715DE2F9E414}
Library
Properties
- JWT.Tests
- JWT.Tests
- v4.6.1
+ JWT.Tests.NETFramework
+ JWT.Tests.NETFramework
+ v4.6
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
+ 15.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
UnitTest
@@ -40,66 +40,51 @@
..\..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll
- True
..\..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll
- True
-
- ..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll
- True
-
-
- ..\..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll
- True
+
+ ..\..\packages\ServiceStack.Text.4.5.6\lib\net45\ServiceStack.Text.dll
+
..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll
- True
..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll
- True
..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll
- True
..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll
- True
-
-
-
+
+
+
- {a80b51b8-ddf6-4026-98a4-b59653e50b38}
+ {2f79eb8d-5b33-4ea6-ac1a-89b107f043d2}
JWT
+
+ {5d0282d5-9cc4-4d42-a3f0-e18270f92184}
+ JWT.Tests.Common
+
-
-
-
-
+
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/tests/JWT.Tests.NETFramework/Properties/AssemblyInfo.cs b/tests/JWT.Tests.NETFramework/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..dce447031
--- /dev/null
+++ b/tests/JWT.Tests.NETFramework/Properties/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("JWT.Tests.NETFramework")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("JWT.Tests.NETFramework")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("88e1db97-3507-4d8c-9b3d-715de2f9e414")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/tests/JWT.Tests/Serializers/ServiceStackJsonSerializer.cs b/tests/JWT.Tests.NETFramework/Serializers/ServiceStackJsonSerializer.cs
similarity index 88%
rename from tests/JWT.Tests/Serializers/ServiceStackJsonSerializer.cs
rename to tests/JWT.Tests.NETFramework/Serializers/ServiceStackJsonSerializer.cs
index ad72e2ba7..2e91208bf 100644
--- a/tests/JWT.Tests/Serializers/ServiceStackJsonSerializer.cs
+++ b/tests/JWT.Tests.NETFramework/Serializers/ServiceStackJsonSerializer.cs
@@ -1,6 +1,6 @@
using ServiceStack.Text;
-namespace JWT.Tests.Serializers
+namespace JWT.Tests.NETFramework.Serializers
{
public class ServiceStackJsonSerializer : IJsonSerializer
{
diff --git a/tests/JWT.Tests/Serializers/WebScriptJsonSerializer.cs b/tests/JWT.Tests.NETFramework/Serializers/WebScriptJsonSerializer.cs
similarity index 89%
rename from tests/JWT.Tests/Serializers/WebScriptJsonSerializer.cs
rename to tests/JWT.Tests.NETFramework/Serializers/WebScriptJsonSerializer.cs
index 07d2c940a..bdaf42c23 100644
--- a/tests/JWT.Tests/Serializers/WebScriptJsonSerializer.cs
+++ b/tests/JWT.Tests.NETFramework/Serializers/WebScriptJsonSerializer.cs
@@ -1,19 +1,19 @@
-using System.Web.Script.Serialization;
-
-namespace JWT.Tests.Serializers
-{
- public class WebScriptJsonSerializer : IJsonSerializer
- {
- public string Serialize(object obj)
- {
- var serializer = new JavaScriptSerializer();
- return serializer.Serialize(obj);
- }
-
- public T Deserialize(string json)
- {
- var serializer = new JavaScriptSerializer();
- return serializer.Deserialize(json);
- }
- }
-}
\ No newline at end of file
+using System.Web.Script.Serialization;
+
+namespace JWT.Tests.NETFramework.Serializers
+{
+ public class WebScriptJsonSerializer : IJsonSerializer
+ {
+ public string Serialize(object obj)
+ {
+ var serializer = new JavaScriptSerializer();
+ return serializer.Serialize(obj);
+ }
+
+ public T Deserialize(string json)
+ {
+ var serializer = new JavaScriptSerializer();
+ return serializer.Deserialize(json);
+ }
+ }
+}
diff --git a/tests/JWT.Tests/packages.config b/tests/JWT.Tests.NETFramework/packages.config
similarity index 50%
rename from tests/JWT.Tests/packages.config
rename to tests/JWT.Tests.NETFramework/packages.config
index 389d447bc..43b57e952 100644
--- a/tests/JWT.Tests/packages.config
+++ b/tests/JWT.Tests.NETFramework/packages.config
@@ -1,13 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/JWT.Tests/App.config b/tests/JWT.Tests/App.config
deleted file mode 100644
index 76b8a72e8..000000000
--- a/tests/JWT.Tests/App.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/JWT.Tests/DecodeTests.cs b/tests/JWT.Tests/DecodeTests.cs
deleted file mode 100644
index 9d8625250..000000000
--- a/tests/JWT.Tests/DecodeTests.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using FluentAssertions;
-using JWT.Serializers;
-using JWT.Tests.Serializers;
-using Xunit;
-
-namespace JWT.Tests
-{
- public class DecodeTests
- {
- private static readonly Customer _customer = new Customer { FirstName = "Bob", Age = 37 };
-
- private const string _token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
- private const string _malformedtoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
-
- private static readonly IDictionary _dictionaryPayload = new Dictionary
- {
- { "FirstName", "Bob" },
- { "Age", 37 }
- };
-
- [Fact]
- public void Decode_Should_Decode_Token_To_Json_Encoded_String_With_JsonNet_Serializer()
- {
- var serializer = new JsonNetSerializer();
- JsonWebToken.JsonSerializer = serializer;
-
- var expectedPayload = serializer.Serialize(_customer);
- var actualPayload = JsonWebToken.Decode(_token, "ABC", verify: false);
-
- actualPayload.Should().Be(expectedPayload);
- }
-
- [Fact]
- public void Decode_Should_Decode_Token_To_Json_Encoded_String_With_WebScript_Serializer()
- {
- var serializer = new WebScriptJsonSerializer();
- JsonWebToken.JsonSerializer = serializer;
-
- var expectedPayload = serializer.Serialize(_customer);
-
- var actualPayload = JsonWebToken.Decode(_token, "ABC", verify: false);
-
- actualPayload.Should().Be(expectedPayload);
- }
-
- [Fact]
- public void Decode_Should_Decode_Token_To_Json_Encoded_String_With_ServiceStack_Serializer()
- {
- var serializer = new ServiceStackJsonSerializer();
- JsonWebToken.JsonSerializer = serializer;
-
- var expectedPayload = serializer.Serialize(_customer);
-
- var actualPayload = JsonWebToken.Decode(_token, "ABC", verify: false);
-
- actualPayload.Should().Be(expectedPayload);
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Dictionary_With_WebScript_Serializer()
- {
- JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_dictionaryPayload, options => options.IncludingAllRuntimeProperties());
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Dictionary_With_ServiceStack_Serializer()
- {
- JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_dictionaryPayload, options => options.IncludingAllRuntimeProperties());
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Dictionary_With_JsonNet_Serializer()
- {
- JsonWebToken.JsonSerializer = new JsonNetSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_dictionaryPayload, options => options.IncludingAllRuntimeProperties());
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Generic_Type_With_WebScript_Serializer()
- {
- JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_customer);
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Generic_Type_With_ServiceStack_Serializer()
- {
- JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_customer);
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_To_Generic_Type_With_JsonNet_Serializer()
- {
- JsonWebToken.JsonSerializer = new JsonNetSerializer();
-
- var actualPayload = JsonWebToken.DecodeToObject(_token, "ABC", verify: false);
-
- actualPayload.ShouldBeEquivalentTo(_customer);
- }
-
- [Fact]
- public void DecodeToObject_Should_Throw_Exception_On_Malformed_Token()
- {
- Action action = () => JsonWebToken.DecodeToObject(_malformedtoken, "ABC", verify: false);
-
- action.ShouldThrow();
- }
-
- [Fact]
- public void DecodeToObject_Should_Throw_Exception_On_Invalid_Key()
- {
- Action action = () => JsonWebToken.DecodeToObject(_token, "XYZ", verify: true);
-
- action.ShouldThrow();
- }
-
- [Fact]
- public void DecodeToObject_Should_Throw_Exception_On_Invalid_Expiration_Claim()
- {
- var invalidexptoken = JsonWebToken.Encode(new { exp = "asdsad" }, "ABC", JwtHashAlgorithm.HS256);
-
- Action action = () => JsonWebToken.DecodeToObject(invalidexptoken, "ABC", verify: true);
-
- action.ShouldThrow();
- }
-
- [Fact]
- public void DecodeToObject_Should_Throw_Exception_On_Expired_Claim()
- {
- var exp = (int)(DateTime.UtcNow.AddHours(-1) - JwtValidator.UnixEpoch).TotalSeconds;
- var expiredtoken = JsonWebToken.Encode(new { exp = exp }, "ABC", JwtHashAlgorithm.HS256);
-
- Action action = () => JsonWebToken.DecodeToObject(expiredtoken, "ABC", verify: true);
-
- action.ShouldThrow();
- }
-
- [Fact]
- public void DecodeToObject_Should_Throw_Exception_Before_NotBefore_Becomes_Valid()
- {
- var nbf = (int)(DateTime.UtcNow.AddHours(1) - JwtValidator.UnixEpoch).TotalSeconds;
- var invalidnbftoken = JsonWebToken.Encode(new { nbf = nbf }, "ABC", JwtHashAlgorithm.HS256);
-
- Action action = () => JsonWebToken.DecodeToObject(invalidnbftoken, "ABC", verify: true);
-
- action.ShouldThrow();
- }
-
- [Fact]
- public void DecodeToObject_Should_Decode_Token_After_NotBefore_Becomes_Valid()
- {
- var nbf = (int)(DateTime.UtcNow - JwtValidator.UnixEpoch).TotalSeconds;
- var validnbftoken = JsonWebToken.Encode(new { nbf = nbf }, "ABC", JwtHashAlgorithm.HS256);
-
- JsonWebToken.DecodeToObject(validnbftoken, "ABC", verify: true);
- }
- }
-}
\ No newline at end of file
diff --git a/tests/JWT.Tests/EncodeTests.cs b/tests/JWT.Tests/EncodeTests.cs
deleted file mode 100644
index c48354c16..000000000
--- a/tests/JWT.Tests/EncodeTests.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System.Collections.Generic;
-using FluentAssertions;
-using JWT.Serializers;
-using JWT.Tests.Serializers;
-using Xunit;
-
-namespace JWT.Tests
-{
- public class EncodeTests
- {
- private static readonly Customer _customer = new Customer { FirstName = "Bob", Age = 37 };
-
- private const string _token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.cr0xw8c_HKzhFBMQrseSPGoJ0NPlRp_3BKzP96jwBdY";
- private const string _extraheaderstoken = "eyJmb28iOiJiYXIiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJCb2IiLCJBZ2UiOjM3fQ.slrbXF9VSrlX7LKsV-Umb_zEzWLxQjCfUOjNTbvyr1g";
-
- [Fact]
- public void Should_Encode_Type_With_WebScript_Serializer()
- {
- JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
-
- var actual = JsonWebToken.Encode(_customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_token);
- }
-
- [Fact]
- public void Should_Encode_Type_With_WebScript_Serializer_And_Extra_Headers()
- {
- JsonWebToken.JsonSerializer = new WebScriptJsonSerializer();
-
- var extraheaders = new Dictionary { { "foo", "bar" } };
- var actual = JsonWebToken.Encode(extraheaders, _customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_extraheaderstoken);
- }
-
- [Fact]
- public void Should_Encode_Type_With_ServiceStack_Serializer()
- {
- JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
-
- var actual = JsonWebToken.Encode(_customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_token);
- }
-
- [Fact]
- public void Should_Encode_Type_With_ServiceStack_Serializer_And_Extra_Headers()
- {
- JsonWebToken.JsonSerializer = new ServiceStackJsonSerializer();
-
- var extraheaders = new Dictionary { { "foo", "bar" } };
- var actual = JsonWebToken.Encode(extraheaders, _customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_extraheaderstoken);
- }
-
- [Fact]
- public void Should_Encode_Type_With_JsonNet_Serializer()
- {
- JsonWebToken.JsonSerializer = new JsonNetSerializer();
-
- var actual = JsonWebToken.Encode(_customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_token);
- }
-
- [Fact]
- public void Should_Encode_Type_With_JsonNet_Serializer_And_Extra_Headers()
- {
- JsonWebToken.JsonSerializer = new JsonNetSerializer();
-
- var extraheaders = new Dictionary { { "foo", "bar" } };
- var actual = JsonWebToken.Encode(extraheaders, _customer, "ABC", JwtHashAlgorithm.HS256);
-
- actual.Should().Be(_extraheaderstoken);
- }
- }
-}
\ No newline at end of file
diff --git a/tests/JWT.Tests/Properties/AssemblyInfo.cs b/tests/JWT.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 931692190..000000000
--- a/tests/JWT.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("JWT.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Public Domain")]
-[assembly: AssemblyProduct("JWT.Tests")]
-[assembly: AssemblyCopyright("Public Domain")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("5dd5d960-dc7d-4dc4-97cb-1024d9184c85")]
-
-[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.0.0")]
diff --git a/tools/NuGet.exe b/tools/NuGet.exe
deleted file mode 100644
index e42e6d827..000000000
Binary files a/tools/NuGet.exe and /dev/null differ