5 ms·
A simple to use Java 8 JWT Library
- hamandcheese 2y agoIs Java 8 still an important minimum target?
- foxyv 2y agoOften it is significantly cheaper to pay for a longer term supported release of an older Java version than it is to upgrade your application to use a later release. So yeah, kinda?
- otobrglez 2y agoYou would be surprised - or rather shocked - how many enterprises still run on it.
- kaba0 2y agoThough to be fair, since a few years ago Java 8 is no longer the most popular java version.
- creshal 2y agoWe just finished upgrading all our Java 1.2 code to Java 17, the Java 6 projects are next :) I doubt we'll get around to the Java 8 stuff before 2030.
- pandemic_region 2y agoInteresting, and a testimony to the stability of the jdk in a way. Did you use any automation tools for the migration I wonder?
- creshal 2y agoThe new code was written by a different department, so I'm a little hazy on the details, but I doubt it. It's a 25 years old line of business app, and it's in violation of every guideline, rule and law it touches, and only alive because it got grandfathered through various certifications and audits. 99% of the work was redesigning the business process it supports to be in compliance, and then write a new LOB app that takes inspiration from the old one, but works with the new process. You might be able to use AI for the remaining 1% mind- and pointless boilerplate code Java requires for no good reason.
- ludicrousdispla 2y agoAre you hiring?
- miningape 2y agoTrust me, you don't want that job :D I've been fighting to get our services to Java 21 from Java 8/11 for the last year or so, I've been partially successful but our main API (and 1/2 monolith) is still a dropwizard app on Java 11
- yardstick 2y agoI expect 1.2 isn’t as bad as going from 1.4 or 8, not as many javax packages back then?
- jillesvangurp 2y agoNo, it's a long deprecated JVM that is effectively abandoned. But it's still a good minimum target as all of its successors tend to be backwards compatible. But you'd typically use one of the more recent LTS versions. Of course there are quite a few crypto libraries out there, including several JWT related ones. A challenge in that space is that there have of course been some platform changes over the years. Not all of the newer algorithms are supported in older JDKs. And some of the alternatives are a bit complicated in terms of dependencies. I've had some issues with some of Google's libraries dragging in everything and the kitchen sink in terms of dependencies and then causing conflicts with my other dependencies when one of those dependencies changes their API. This one looks like it builds on bouncycastle and not much else. Which explains how it is not really that dependent on what comes with the JDK as bouncy castle provides its own implementations for a lot of the popular crypto stuff.
- tveita 2y agoThis doesn't depend on BouncyCastle AFAICT, by default it uses javax.crypto but you can change it for a BouncyCastle security provider. https://github.com/FusionAuth/fusionauth-jwt/blob/main/src/main/java/io/fusionauth/security/DefaultCryptoProvider.java https://github.com/FusionAuth/fusionauth-jwt/blob/main/src/m...
- webprofusion 2y agoJava 8, as in from 2014?
- creshal 2y agoJava 8, as in "extended support until 2030 because too many companies would rather pay for that than upgrade"
- yardstick 2y agoHonestly it just shows how poorly executed the changes were in 9, 11, 17 that made it so difficult for companies to migrate.
- markus92 2y agoThe javax stuff really got us.
- alyandon 2y agoIndeed and I wish more people really understood this. I don't really like to target JDK8 as a supported version at work. However, I have to because of large, complex dependencies (some third-party with no source available) that have no drop-in replacements that will work under JDK9 and beyond. Finding replacements for dependencies (or rewriting them), testing, etc to move to newer versions of Java is a cost the business is not willing to absorb at this point. I expect that eventually when JDK8 has no viable support options and the cost of maintenance becomes too great the business will decide to jettison the whole stack and replace it with something else that likely won't be Java based.
- zelos 2y agoScaled from Java years to JS frontend years, that's like late 2022.
- robertlagrant 2y agoCertainly from a build system perspective.
- DidYaWipe 2y agoThe current version of Java is 23. If version 8 is still a relevant target, there's a problem.
- RedShift1 2y agoJava 8 is still supported until at least 2026, so why not target it?
- znpy 2y agobecause you'd be doing throwaway work, and 2026 is basically one year from now. actually you're doing worse than throwaway work: you're creating more work (one more thing to migrate to newer java in 2026).
- RedShift1 2y agoI've migrated projects from Java 8 to 21 with little changes, I think for a lightweight library like this it wouldn't even matter.
- krzyk 2y agoMigrating anything at least somehow complicated past Java 8 is PITA. When you are at Java 9, you are half done. Full done if you don't use some libraries that abuse JVM (like lombok). For most of those it would be enough to upgrade to newest versions. BTW. Next year we will have Java 25.
- unscaled 2y agoI'm pretty sad to see all these JWT libraries which go out of their way to implement RSA-based algorithms (don't we all love massively-sized tokens? with ancient and hard-to-secure algorithms), why they almost universally fail to implement the most decent option JOSE offers for asymmetric signatures: Ed25519 [1]. [1] https://datatracker.ietf.org/doc/html/rfc8032 https://datatracker.ietf.org/doc/html/rfc8032
- RedShift1 2y agoRSA is hard to secure? As far as I know, 2048 bit RSA has still not been cracked?
- robertlagrant 2y agoAs in hard to get the implementation right.
- RedShift1 2y agoWhy would you write your own implementation when RSA functions are baked into Java's standard library?
- unscaled 2y agoWhy would you trust that the RSA implementation baked into Java (or anything for that matter), is safe? Java is also implemented by human beings. The Java RSA implementation apparently had a timing side-channel attack vulnerability for many years that was only discovered this year[1]. I don't know if there were more serious issues with the Java RSA implementation, in the past, but the same cannot be said about their ECDSA implementation. It was completely broken for a while before it was discovered[2]. Bad implementation can happen with any algorithm, but if the algorithm is simpler and built to be more foolproof like Ed25519, that's just far less likely. Unfortunately most of these libraries are not written by a professional cryptographer who codes without bugs, and even Daniel J. Bernstein, a cryptography expert who IS famous for writing software without almost no bugs[3], criticized RSA and ECDSA[4] and designed Ed25519. To be honest, if even djb doesn't want to implement RSA and ECDSA then I honestly think nobody should. --- [1] https://www.rapid7.com/db/vulnerabilities/redhat_linux-cve-2024-20952/ https://www.rapid7.com/db/vulnerabilities/redhat_linux-cve-2... [2] https://www.cryptomathic.com/blog/explaining-the-java-ecdsa-critical-vulnerability https://www.cryptomathic.com/blog/explaining-the-java-ecdsa-... [3] http://www.aaronsw.com/weblog/djb http://www.aaronsw.com/weblog/djb [4] https://blog.cr.yp.to/20140323-ecdsa.html https://blog.cr.yp.to/20140323-ecdsa.html
- mooreds 2y agoFor anyone interested in the JWT decoding/verifying speed, there's a benchmark here: https://github.com/skjolber/java-jwt-benchmark https://github.com/skjolber/java-jwt-benchmark