Skip to content

Commit caf2156

Browse files
committed
removing public key from ECC token
1 parent afa007d commit caf2156

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cas-dotnet-helpers/JWT.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ public async Task<bool> ValidateECCToken(string token, ECDsa publicKey)
6060
return result.IsValid;
6161
}
6262

63-
public string GenerateECCToken(string userId, bool isAdmin, ECDSAWrapper key, double hoursToAdd, string? subscriptionPublicKey = null)
63+
public string GenerateECCToken(string userId, bool isAdmin, ECDSAWrapper ecdsaKey, double hoursToAdd, string? subscriptionPublicKey = null)
6464
{
6565
var handler = new JsonWebTokenHandler();
6666
DateTime now = DateTime.UtcNow;
6767
List<Claim> claims = new List<Claim>()
6868
{
6969
new Claim(Constants.TokenClaims.Id, userId),
70-
new Claim(Constants.TokenClaims.PublicKey, key.PublicKey),
7170
new Claim(Constants.TokenClaims.IsAdmin, isAdmin.ToString())
7271
};
7372
if (subscriptionPublicKey != null)
@@ -81,7 +80,7 @@ public string GenerateECCToken(string userId, bool isAdmin, ECDSAWrapper key, do
8180
Expires = now.AddHours(1),
8281
IssuedAt = now,
8382
Subject = new ClaimsIdentity(claims),
84-
SigningCredentials = new SigningCredentials(new ECDsaSecurityKey(key.ECDKey), "ES256")
83+
SigningCredentials = new SigningCredentials(new ECDsaSecurityKey(ecdsaKey.ECDKey), "ES256")
8584
});
8685
return token;
8786
}

cas-dotnet-helpers/cas-helpers.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<RootNamespace>CASHelpers</RootNamespace>
77
<Nullable>enable</Nullable>
88
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
99
<Title>cas-helpers</Title>
10-
<Version>1.0.19</Version>
10+
<Version>1.0.20</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>

0 commit comments

Comments
 (0)