I'm upgrading my Java/Kotlin project to use JJWT version 0.12.6, and I noticed that the methods Jwts.parser() and setSigningKey(Key) are now deprecated.
What I want:
How to correctly parse and validate JWT tokens using the latest JJWT API without deprecated methods.
What I've tried:
val claims = Jwts.parser()
.setSigningKey(key)
.parseClaimsJws(token)
.body
Since 0.12.0 to get all claims from Token (also to validate it):
private Claims getAllClaimsFromToken(String token) {
return Jwts.parser()
.verifyWith(getPublicSigningKey())
.build()
.parseSignedClaims(token)
.getPayload();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With