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

Compatibility with 6x for bool claims #2367

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Compatibility with 6x for bool claims #2367

merged 2 commits into from
Oct 16, 2023

Conversation

keegan-caruso
Copy link
Contributor

@keegan-caruso keegan-caruso commented Oct 16, 2023

Fix behavior where ToString is used on bool values resulting in the value being True/False instead of true/false

Description

restores previous behavior for bool claims

Fixes #2354

Fix behavior where ToString is used on bool values
resulting in the value being True/False instead of true/false
Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @keegan-caruso

@jennyf19 jennyf19 merged commit 67ae82e into dev Oct 16, 2023
5 checks passed
jennyf19 pushed a commit that referenced this pull request Jan 9, 2024
Compatibility with 6x for bool claims (#2367)

* Compatibility with 6x for bool claims

Fix behavior where ToString is used on bool values
resulting in the value being True/False instead of true/false

* Use direct ClaimValueType

---------

Co-authored-by: Keegan Caruso <[email protected]>

----
#### AI-Generated Description
The pull request modifies the handling of boolean claims in the JsonWebToken library. It changes the encoding and decoding of boolean values to use lowercase "true" and "false" instead of uppercase "True" and "False". It also adds unit tests to verify the expected behavior. The main changes are in the following files:
- **JsonWebTokenTests.cs**: Adds a new test method `BoolClaimsEncodedAsExpected` to check the encoding and decoding of boolean claims.
- **JwtPayload.cs**: Adds logic to handle boolean values in the `CreateClaims` and `CreateClaimFromObject` methods.
- **JsonClaimSet.cs**: Adds logic to handle boolean values in the `CreateClaimFromObject` and `CreateClaimFromJsonElement` methods.
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] Subtle breaking change in claim deserialization in v7
4 participants