Skip to content

Commit

Permalink
Bump System.IdentityModel.Tokens.Jwt from 6.5.0 to 6.34.0 in /src/Aut…
Browse files Browse the repository at this point in the history
…h0.AuthenticationApi (#702)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Frederik Prijck <[email protected]>
  • Loading branch information
dependabot[bot] and frederikprijck authored Jan 10, 2024
1 parent 24a6502 commit 020e3fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Auth0.AuthenticationApi/Auth0.AuthenticationApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.34.0" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/Auth0.AuthenticationApi/Tokens/SignedDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public JwtSecurityToken DecodeSignedToken(string token)
}
catch (SecurityTokenSignatureKeyNotFoundException ex)
{
if (signatureAlgorithm == JwtSignatureAlgorithm.HS256)
{
throw new IdTokenValidationException("Invalid token signature.", ex);
}
throw new IdTokenValidationKeyMissingException("Token signature key could not be found", ex);
}
catch (SecurityTokenException ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace Auth0.AuthenticationApi.IntegrationTests.Tokens
{
public class SymmetricSignedDecoderTests : TestBase
{
readonly SignedDecoder hs256Verifier = new SymmetricSignedDecoder("AUTH0_VALID_CLIENT_SECRET");
readonly SignedDecoder hs256Verifier = new SymmetricSignedDecoder("___AUTH0_VALID__CLIENT_SECRET___");

[Fact]
public void SucceedsWhenSignatureIsValid()
{
var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("AUTH0_VALID_CLIENT_SECRET"));
var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("___AUTH0_VALID__CLIENT_SECRET___"));

var tokenFactory = new JwtTokenFactory(key, SecurityAlgorithms.HmacSha256Signature);

Expand All @@ -26,7 +26,7 @@ public void SucceedsWhenSignatureIsValid()
[Fact]
public void ThrowsWhenSignatureIsInvalid()
{
var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("AUTH0_INVALID_CLIENT_SECRET"));
var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("__AUTH0_INVALID__CLIENT_SECRET__"));

var tokenFactory = new JwtTokenFactory(key, SecurityAlgorithms.HmacSha256Signature);

Expand Down

0 comments on commit 020e3fc

Please sign in to comment.