Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonWebKey deserialization depends on global JsonSerializerOptions #54

Closed
50c opened this issue Feb 6, 2024 · 2 comments · Fixed by #61
Closed

JsonWebKey deserialization depends on global JsonSerializerOptions #54

50c opened this issue Feb 6, 2024 · 2 comments · Fixed by #61

Comments

@50c
Copy link
Contributor

50c commented Feb 6, 2024

Hi,
I'm a happy user of your helpful library, but recently I have encounted a problem. After some updates on my project, the SigningCredentials returned by the library was not accepted anymore for jwt signing and throws misleading error:

System.NotSupportedException: IDX10621: 'Microsoft.IdentityModel.Tokens.SymmetricSignatureProvider' supports: 'Microsoft.IdentityModel.Tokens.SecurityKey' of types: 'Microsoft.IdentityModel.Tokens.AsymmetricSecurityKey' or 'Microsoft.IdentityModel.Tokens.SymmetricSecurityKey'. SecurityKey received was of type 'Microsoft.IdentityModel.Tokens.JsonWebKey'.

After further investigation and debugging, I found that returned SecurityKey has just default values for his properties. This was caused by wrong deserialization of JsonWebKey by KeyMaterial.GetSecurityKey that is depending on JsonSerializerOptions

I have the small fix for this that I could send as merge request.

@brunobritodev
Copy link
Member

Ok, great!! Send a PR

@sherlock1982
Copy link

This will also close #47

brunobritodev added a commit that referenced this issue Apr 19, 2024
Updated to latest dep's fixing critical Security warnings

close #47
close #54
github-actions bot pushed a commit that referenced this issue Apr 19, 2024
## [8.1.4](v8.1.3...v8.1.4) (2024-04-19)

### Bug Fixes

* HS256 incompatibility ([8f688b1](8f688b1)), closes [#47](#47) [#54](#54)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants