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

fix: Do not include null values in JWT payloads #516

Merged
merged 3 commits into from
Feb 10, 2020

Conversation

thinkingserious
Copy link
Contributor

The JWT payloads should not contain null values. This fix ensures any null values do not get included when serializing the Payload class.

Reference: https://www.baeldung.com/jackson-ignore-null-fields

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the master branch
  • I have added tests that prove my fix is effective or that my feature works

@thinkingserious thinkingserious added difficulty: easy fix is easy in difficulty status: code review request requesting a community code review or review from Twilio type: bug bug in the library labels Feb 9, 2020
@@ -336,4 +338,18 @@ public void testVoiceTokenWithoutIncoming() {
Assert.assertEquals("AP123", outgoing.get("application_sid"));
Assert.assertEquals("bar", outgoingParams.get("foo"));
}

@Test()
public void testNullValues() throws JsonProcessingException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Changes looks fine, but there's a lot of duplicated code in this test class. Could you refactor the obvious bits? Also, the other tests use a JWT parser to validate the payload rather than an object mapper. I prefer making this one uniform with the others so we know the payload conforms rather than what an object mapper produces.

@thinkingserious thinkingserious merged commit 2e47fde into master Feb 10, 2020
@thinkingserious thinkingserious deleted the jwt-null-values branch February 10, 2020 20:56
FalguniV pushed a commit to FalguniV/twilio-java that referenced this pull request Oct 13, 2020
FalguniV pushed a commit to FalguniV/twilio-java that referenced this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy fix is easy in difficulty status: code review request requesting a community code review or review from Twilio type: bug bug in the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants