Repository navigation
Conversation
Resolves jwtk#1029. jjwt-jackson now uses Jackson 3 (tools.jackson), so anyone already depending on it is upgraded automatically, while jjwt-jackson2 remains available for Java 8 through 16 and Jackson 2
CHANGELOG (0.14.0): what changes for each kind of user, and the backwards-incompatible consequences of jjwt-jackson requiring Java 17 and Jackson 3. README: installation snippets, the JSON support overview, the Jackson section (Jackson 3 ObjectMappers are never modified; reuse serializer and deserializer instances), and a new Jackson 2 subsection.
|
Tested this branch in a real Spring Boot 4.1 service (Java 17, Jackson 3.1.5): existing tokens parse and the claims come out the same as before. I also compared it with 0.13.0 using a token with dates, large numbers, nested maps, lists and non-ASCII text: both versions produce byte-identical tokens and each parses the other's. |
| <dependency> | ||
| <groupId>io.jsonwebtoken</groupId> | ||
| <artifactId>jjwt-jackson</artifactId> | ||
| <version>0.14.0-SNAPSHOT</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.jsonwebtoken</groupId> | ||
| <artifactId>jjwt-jackson2</artifactId> | ||
| <version>0.14.0-SNAPSHOT</version> | ||
| </dependency> |
There was a problem hiding this comment.
-1
make the new module jjwt-jackson3 so we do not get a breaking change and WAY less diff.
There was a problem hiding this comment.
Leaving this open for now. If the maintainers want a jjwt-jackson3 module I'll just switch it. See my comment below.
I hope @lhazlewood accepts this. The last time I tried this (JakartaEE jsonp/jsonb with Java 8 when the project was still Java 7), it was declined. I hope this will now be accepted. I'd vote for a new jackson3 module instead of re-using the old module for jackson 3 and copying the old jackson module to jackson2 so we do not get a breaking change. WDYT? |
|
Thanks for looking! I only went this way because that's what @lhazlewood asked for in #1032 (#1032 (comment)):
A separate I don't have a strong opinion on it myself. If the maintainers prefer Also agree with your point in the issue (#1029 (comment)) that dealing with two Jackson versions is a pain. So maybe it's worth setting an end of support date for the Jackson 2 module, whichever name it ends up with. |
I can relate ;)
I see. I do think in breaking changes, and I just do not see why this would be more useful than the other way around, but in the end it does not matter too much. True.
OH! Yeah but it is managable for some time for such a project.
Great idea! I hope the maintainers agree! |
Resolves #1029.
This follows the structure described by @lhazlewood in #1032:
jjwt-jacksonnow uses Jackson 3 (tools.jackson), so existing dependents are upgraded automatically.jjwt-jackson2module (packageio.jsonwebtoken.jackson2.io).jjwt-jackson-testkitmodule, not copied.Behavior
A literal port changes the JSON JJWT writes and accepts, because Jackson 3 changed several defaults:
java.util.Datevalues become ISO-8601 strings, enums are written withtoString(), trailing content is rejected, and collection properties without setters are left empty. JJWT's defaultObjectMappertherefore usesMapperBuilder#configureForJackson2(), so output and parsing are unchanged. Both modules pass the same shared tests, including 18 new ones that pin this behavior.Build
extensions/jacksonis compiled for Java 17; everything else still targets Java 8.jjwt-impl's tests usejjwt-jackson2, so they still run on every JDK in the matrix.jjwtjar skip the JDK 8 and 11 test legs.ci.ymlis unchanged.Verification
verify -Possrh -Dgpg.skip=trueon JDK 17: all modules pass (1,816 tests).-Dtest.jdk.version=8on a Java 8 runtime: passes, with the two Java 17 modules skipped.0.14.xbranch (0.14.x #1059), and the combined build passes.Questions for maintainers
jjwtjar followsjjwt-jacksonand so now requires Java 17. Should it point atjjwt-jackson2instead?0.14.xif that is preferred overmain.