-
Notifications
You must be signed in to change notification settings - Fork 925
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
Not allowed null values in Map #511
Comments
You are correct; our null-handling is a bit inconsistent throughout, and is something we should handle consistently. @lbalmaceda do you have the history for why we do not allow |
@jimmyjames I don't remember why we made that decision but I see that what @yeDor is seeing is documented correctly java-jwt/lib/src/main/java/com/auth0/jwt/JWTCreator.java Lines 365 to 366 in 364bf59
I do remember that we decided that when a claim's value was null, we deleted/removed that claim from the JWT we output, instead of adding it with a null value. If that's not the case and the claim Also, beware that changing these things could imply a breaking change in behavior. |
Hello, could you please allow null values in a Map, again? I understand the reasoning behind not allowing null keys but it isn't very useful for the values. This issue is really preventing me from using your library because I have custom subject claims that have an object with null values. I don't want to remove it from the map, I need it to be there for the frontend. For example:
Thank you. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇♂️ |
We will be consistently handling |
Hello 👋 We have fixed this behaviour in our latest v4.0.0-beta.0 release. We will close this issue now. Please try the new release and provide your feedback. Please note that there are changes in the library's behaviour in the new major and check out our Migration Guide to migrate your library. |
Describe the problem
For not clear reasons library do not accept null values in maps. Check can be found in com.auth0.jwt.JWTCreator.Builder#validateClaim(java.util.Map).
Having payload =
{"meta": null,"products": [{"metaInMap": null}]}
following codewill cause an exception:
Note:
meta -> null
is ok, butmetaInMap -> null
produces an exceptionWhat was the expected behavior?
Maps can contain nulls without causing exceptions.
Environment
The text was updated successfully, but these errors were encountered: