Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit f543343

Browse files
committed
IdentityTokenValidator - update wilson dependency
1 parent ef8815b commit f543343

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/IdentityTokenValidator/IdentityTokenValidator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<ItemGroup>
3737
<PackageReference Include="minver" Version="4.3.0" PrivateAssets="All" />
3838

39-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.30.0" />
39+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
4040
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
4141
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
4242
</ItemGroup>

src/IdentityTokenValidator/JwtHandlerIdentityTokenValidator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task<IdentityTokenValidationResult> ValidateAsync(string identityTo
8181
};
8282
}
8383

84-
var result = ValidateSignature(identityToken, handler, parameters, options, logger);
84+
var result = await ValidateSignatureAsync(identityToken, handler, parameters, options, logger);
8585
if (result.IsValid == false)
8686
{
8787
if (result.Exception is SecurityTokenSignatureKeyNotFoundException)
@@ -123,7 +123,7 @@ public async Task<IdentityTokenValidationResult> ValidateAsync(string identityTo
123123
};
124124
}
125125

126-
private TokenValidationResult ValidateSignature(string identityToken, JsonWebTokenHandler handler, TokenValidationParameters parameters, OidcClientOptions options, ILogger logger)
126+
private async Task<TokenValidationResult> ValidateSignatureAsync(string identityToken, JsonWebTokenHandler handler, TokenValidationParameters parameters, OidcClientOptions options, ILogger logger)
127127
{
128128
if (parameters.RequireSignedTokens)
129129
{
@@ -174,7 +174,7 @@ private TokenValidationResult ValidateSignature(string identityToken, JsonWebTok
174174
parameters.IssuerSigningKeys = keys;
175175
}
176176

177-
return handler.ValidateToken(identityToken, parameters);
177+
return await handler.ValidateTokenAsync(identityToken, parameters);
178178
}
179179

180180
private static string CheckRequiredClaim(ClaimsPrincipal user)

test/JwtValidationTests/Infrastructure/Crypto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static IdentityModel.Jwk.JsonWebKeySet CreateKeySet(RsaSecurityKey key)
7878
public static string CreateJwt(RsaSecurityKey key, string issuer, string audience, params Claim[] claims)
7979
{
8080
var jwtClaims = new List<Claim>(claims);
81-
jwtClaims.Add(new Claim(JwtClaimTypes.IssuedAt, "now"));
81+
jwtClaims.Add(new Claim(JwtClaimTypes.IssuedAt, DateTime.UtcNow.Ticks.ToString(), ClaimValueTypes.Integer64));
8282

8383
SigningCredentials credentials = null;
8484
if (key != null)

test/JwtValidationTests/Infrastructure/NetworkHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Net;
77
using System.Net.Http;
8+
using System.Text;
89
using System.Threading;
910
using System.Threading.Tasks;
1011

@@ -86,11 +87,11 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
8687
{
8788
if (_selector != null)
8889
{
89-
response.Content = new StringContent(_selector(request));
90+
response.Content = new StringContent(_selector(request), Encoding.UTF8, "application/json");
9091
}
9192
else
9293
{
93-
response.Content = new StringContent(_document);
94+
response.Content = new StringContent(_document, Encoding.UTF8, "application/json");
9495
}
9596
}
9697

0 commit comments

Comments
 (0)