Having trouble upgrading from an old version of jjwt #955
-
Hello, I am having trouble updating an old Java 8 project that uses jjwt 0.7.0. I am trying to update to the latest version at this time which is 0.12.6. Here is the existing code:
I am getting the following exception:
Is there a guide or FAQ on migrating this code from an older version of JJWT? I would prefer to avoid having to do a major refactor or rewrite, just hoping there are some simple changes to get to a working version. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Try the Or the more detailed section on reading a JWS |
Beta Was this translation helpful? Give feedback.
-
Hi @landryraccoon! There isn't a formal dedicated guide per se, but there is an extensive list of changes in the Also, most developers have the IDE tell them when a deprecated method is used, e.g. the method is often highlighted as a warning: or when authoring: Upon encountering such a method, we always indicate in JavaDoc what the alternative is. For example, seeing that
as well as the bold So then we know to use If not using an IDE, the JavaCompiler will also print out deprecation warnings (unless overridden/disabled by the developer and/or build tool). Anyway, in your code example,
(even if you didn't want to read a wall of text in that section, people often ctrl-F (or cmd-F) to find the method they care about and find that in the changelog). Since Claims claims = Jwts.parser()
.verifyWith(secret)
.build() // <----
.parseSignedClaims(token)
.getPayload(); And if you're using an IDE, it'll tell you the return value types associated with the various methods, e.g. Anyway, I hope that's helpful! Feel free to ask anything else if you get stuck! |
Beta Was this translation helpful? Give feedback.
-
Closing due to inactivity. Feel free to request to re-open if there's anything else! |
Beta Was this translation helpful? Give feedback.
Hi @landryraccoon!
There isn't a formal dedicated guide per se, but there is an extensive list of changes in the
0.12.0
https://github.com/jwtk/jjwt/blob/0.12.6/CHANGELOG.md#0120 following through to0.12.6
that was written in a way meant to guide people going through an upgrade.Also, most developers have the IDE tell them when a deprecated method is used, e.g. the method is often highlighted as a warning:
or when authoring:
Upon encountering such a method, we always indicate in JavaDoc what the alternative is. For example, seeing that
setSigningKey
has a line through it and is therefore deprecated, that method's JavaDoc says: