Skip to content

Commit

Permalink
Target .NETFramework 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarbettini committed Mar 28, 2017
1 parent 388eabb commit eca1b29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/JWT/Algorithms/RS256Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public RS256Algorithm(X509Certificate2 cert)

public byte[] Sign(byte[] key, byte[] bytesToSign)
{
#if NET45
var rsa = (RSACryptoServiceProvider)_cert.PrivateKey;
#else
#if NETSTANDARD1_3
var rsa = (RSACryptoServiceProvider)_cert.GetRSAPrivateKey();
#else
var rsa = (RSACryptoServiceProvider)_cert.PrivateKey;
#endif
var param = new CspParameters
{
Expand Down
6 changes: 3 additions & 3 deletions src/JWT/JWT.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
<TargetFrameworks>net35;netstandard1.3</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net35'">
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<DefineConstants>NET45</DefineConstants>
<DefineConstants>NET35</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
Expand Down
6 changes: 3 additions & 3 deletions src/JWT/JsonWebToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class JsonWebToken
/// </summary>
public static IJsonSerializer JsonSerializer = new JsonNetSerializer();

private static readonly Lazy<IJwtValidator> _jwtValidator = new Lazy<IJwtValidator>(() => new JwtValidator(JsonSerializer, new UtcDateTimeProvider()));
private static readonly IJwtValidator _jwtValidator = new JwtValidator(JsonSerializer, new UtcDateTimeProvider());

private static readonly AlgorithmFactory _algorithmFactory = new AlgorithmFactory();

Expand Down Expand Up @@ -103,7 +103,7 @@ public static string Decode(string token, byte[] key, bool verify = true)
{
return new JwtDecoder(
JsonSerializer,
_jwtValidator.Value)
_jwtValidator)
.Decode(token, key, verify);
}

Expand Down Expand Up @@ -177,7 +177,7 @@ public static T DecodeToObject<T>(string token, byte[] key, bool verify = true)
/// <exception cref="TokenExpiredException">The token has expired.</exception>
public static void Verify(string payloadJson, string decodedCrypto, string decodedSignature)
{
_jwtValidator.Value.Validate(payloadJson, decodedCrypto, decodedSignature);
_jwtValidator.Validate(payloadJson, decodedCrypto, decodedSignature);
}

/// <remarks>From JWT spec</remarks>
Expand Down

0 comments on commit eca1b29

Please sign in to comment.