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

Re-enable JwtPayload and JsonWebToken to process a JWT where 'sub' claim is set as a Number instead of String. #2398

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

FuPingFranco
Copy link
Contributor

@FuPingFranco FuPingFranco commented Nov 10, 2023

Description

This PR re-enables incoming Jwt's to set the 'sub' claim as a Number type in their payloads.

  • Added a new method "ReadStringOrNumberAsString" in the JsonSerializerPrimitives. It will process the 'sub' claim that comes in either as String or Number and will always return it back as a string.
  • Replaced 'sub' claim logic to leverage ReadNumberAsString method in JwtPayload.cs
  • Replaced 'sub' claim logic to leverage ReadNumberAsString method in JsonWebToken.cs

Fixes #2325

Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@FuPingFranco FuPingFranco merged commit c633486 into dev Nov 14, 2023
4 checks passed
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 this pull request may close these issues.

[Bug] System.IdentityModel.Tokens.Jwt 7.* broke loose JWT parsing
5 participants