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

[SDK-3231] Added support for multiple checks on a single claim #573

Merged
merged 8 commits into from
Apr 13, 2022

Conversation

poovamraj
Copy link
Contributor

@poovamraj poovamraj commented Apr 6, 2022

Changes

  • We have added option where multiple claim checks can be done for same claim.
  • This causes breaking change to the existing behaviour where only one check can be done over a claim.
  • This also overrides the behaviour where if null is passed to a claim check, the check will get removed. Instead, now it will check for null value for that claim

Before this code removes the check for claim with 123
After the code checks for claim to have value 123 and then checks for value null

JWT.require(Algorithm.HMAC256("secret"))
                .withClaim("claim", 123)
                .withClaim("claim", (Integer) null)
                .build();

Before this code overrides the check for claim with check1 to check2
After the code checks for claim to have value check1 and check2

JWT.require(Algorithm.HMAC256("secret"))
                .withClaim("claim", "check1")
                .withClaim("claim", "check2")
                .build();

Before this code doesn't check for the claim value
After the code checks for claim to have null

JWT.require(Algorithm.HMAC256("secret"))
                .withClaim("claim", (Integer) null)
                .build();

References

#558

Testing

  • We have added tests to ensure null values are checked properly in the claim

  • We have tested that multiple claim checks are added

  • Improved branch coverage to ~98%

  • This change adds test coverage

  • This change has been tested on the latest version of Java or why not

@poovamraj poovamraj requested a review from a team as a code owner April 6, 2022 18:40
@jimmyjames jimmyjames changed the title Added support for multiple checks on a single claim [SDK-3231] Added support for multiple checks on a single claim Apr 7, 2022
@jimmyjames jimmyjames added this to the v4-Beta milestone Apr 7, 2022
@poovamraj poovamraj force-pushed the claim-verification-behaviour-for-multiple-checks branch 3 times, most recently from bf5b476 to 8ad09b8 Compare April 12, 2022 12:38
Copy link
Contributor

@jimmyjames jimmyjames left a comment

Choose a reason for hiding this comment

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

👍

@poovamraj poovamraj merged commit af04b22 into v4-dev Apr 13, 2022
@poovamraj poovamraj modified the milestones: v4-Beta, 4.0.0-beta.0 May 6, 2022
@jimmyjames jimmyjames deleted the claim-verification-behaviour-for-multiple-checks branch October 15, 2022 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants