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

Commit dcdb7ab

Browse files
accomodate for breaking changes in JWT handler
1 parent eb763ae commit dcdb7ab

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/IdentityTokenValidator/IdentityTokenValidator.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<ItemGroup>
3030
<PackageReference Include="minver" Version="2.5.0" PrivateAssets="All" />
3131

32-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.9.0" />
32+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.0" />
3333
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
3434
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
3535
</ItemGroup>

src/IdentityTokenValidator/JwtHandlerIdentityTokenValidator.cs

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public async Task<IdentityTokenValidationResult> ValidateAsync(string identityTo
9494
};
9595
}
9696

97+
if (result.Exception is SecurityTokenUnableToValidateException)
98+
{
99+
return new IdentityTokenValidationResult
100+
{
101+
Error = "unable_to_validate_token"
102+
};
103+
}
104+
97105
throw result.Exception;
98106
}
99107

test/JwtValidationTests/CodeFlowResponseTestsWithJwtValidation.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ public async Task No_keyset_for_identity_token_should_fail()
601601
var result = await client.ProcessResponseAsync(url, state);
602602

603603
result.IsError.Should().BeTrue();
604-
result.Error.Should().Contain("invalid_signature");
604+
result.Error.Should().Contain("unable_to_validate_token");
605605
}
606606

607607
[Fact]
@@ -626,7 +626,7 @@ public async Task Untrusted_identity_token_should_fail()
626626
var result = await client.ProcessResponseAsync(url, state);
627627

628628
result.IsError.Should().BeTrue();
629-
result.Error.Should().Contain("invalid_signature");
629+
result.Error.Should().Contain("unable_to_validate_token");
630630
}
631631

632632
[Theory]

0 commit comments

Comments
 (0)