Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The inherited Java 21 compiler target breaks Java 17 compatibility for keycloak-client-registration-api, causing Java 17 consumers to fail with UnsupportedClassVersionError.
1 open issue
What changed in this PR
This PR raises Keycloak server’s minimum Java version to OpenJDK 21, addressing #52369, and aligns build settings, CI, and documentation.
Changes:
- Sets the parent compiler default to Java 21 and removes module-level Java 17 overrides.
- Raises the Jackson 3 admin client’s compiler release to Java 21.
- Removes Java 17 from the affected CI matrix and documents the new server requirement.
| File | Description |
|---|---|
rest/admin-v2/services/pom.xml |
Inherits compiler and encoding settings from the parent. |
pom.xml |
Defines Java 21 as the default server compiler level. |
misc/vuln-to-issues/pom.xml |
Removes local compiler and encoding overrides. |
misc/theme-verifier/pom.xml |
Removes local compiler and encoding overrides. |
misc/db-compatibility-verifier/pom.xml |
Removes local compiler and encoding overrides. |
integration/admin-client-jackson3/pom.xml |
Raises the compiler release to Java 21. |
docs/guides/server/supported-configurations.adoc |
Removes OpenJDK 17 from supported server runtimes. |
docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc |
Adds the Java minimum-version migration notice. |
docs/building.md |
Updates build prerequisites to JDK 21 or 25. |
.github/workflows/ci.yml |
Removes Java 17 from the affected test matrix. |
Review effort: Balanced
There was a problem hiding this comment.
There are more references to Java 17:
.github/copilot-instructions.md:12– "JDK: 17, 21, or 25 … the Maven compiler release is 17"docs/guides/high-availability/single-cluster/concepts-threads.adoc:18– "remove this paragraph once OpenJDK 17 is no longer supported on the server side"operator/README.md:10– "only enabled if the installed JDK is 17 or newer"operator/README.md:14– "Ensure you have JDK 17 (or newer) installed"docs/guides/server/fips.adoc:19– link to the OpenJDK 17 FIPS documentationdocs/guides/server/fips.adoc:167– "latest OpenJDK 17 … older OpenJDK 17" caveatdocs/guides/server/fips.adoc:177– "OpenJDK 21 and newer versions of OpenJDK 17"docs/guides/server/fips.adoc:235– "Not needed with OpenJDK 21 or newer OpenJDK 17"
I found some references in the comments but these imply some refactoring is required so that's out of scope here, so stating it here JFTR:
crypto/default/src/main/java/org/keycloak/crypto/def/BCUserIdentityExtractorProvider.java:153– "we still need to support Java 17"crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronUserIdentityExtractorProvider.java:133– "we still need to support Java 17"crypto/fips1402/src/main/java/org/keycloak/crypto/fips/BCFIPSUserIdentityExtractorProvider.java:151– "we still need to support Java 17"crypto/fips1402/src/main/java/org/keycloak/crypto/fips/FIPS1402Provider.java:342– OpenJDK 17 on RHEL 8 workaroundtestsuite/integration-arquillian/servers/auth-server/common/fips/kc.java.security:12– OpenJDK 17 TODOdocs/documentation/tests/pom.xml:6– JRuby warning "on JDK17" comment
fd4ce8a to
6741fd7
Compare
6741fd7 to
fbf2edd
Compare
Closes keycloak#52369 Signed-off-by: stianst <[email protected]>
fbf2edd to
61da7cf
Compare
| * cacerts uses "changeit" as a conventional default password, and may be JKS on older JDKs. | ||
| * When isImplicitJreTruststore is true, password and provider are always null. | ||
| */ | ||
| private static KeyStore loadDefaultTruststore(String path, String type, String password, String provider, boolean isImplicitJreTruststore) { | ||
| private static KeyStore loadDefaultTruststore(String path, String type, String password, String provider) { |
There was a problem hiding this comment.
the isImplicitJreTruststore parameter, the "changeit" fallback, and the JKS/"older JDKs" reference were all removed in this PR. Might worth to update to match the new signature, e.g. just "Load a truststore from the given path."
| <maven.compiler.source>${java.adapter.minimum.version}</maven.compiler.source> | ||
| <maven.compiler.target>${java.adapter.minimum.version}</maven.compiler.target> | ||
| <maven.compiler.release>${java.adapter.minimum.version}</maven.compiler.release> |
There was a problem hiding this comment.
Note: This is only cosmetic, and not a dealbreaker to merge this PR, so use it if you think it makes sense.
The only scenario where the comment below makes sense is if someone tries to use keycloak-admin-v2-api as a dependency in a project running on Java 8 or Java 11 outside Keycloak.
They'd see that the artifact warning Java 8 compatibility, add it to their project, and then get NoClassDefFoundError at runtime when the JVM tries to load the Jakarta EE 10 classes.
If that's acceptable, you don't need to read the text below :)
This is changing the compiler target from Java 11 to Java 8. The module depends on Jakarta EE 10 APIs (jakarta.ws.rs-api, jakarta.validation-api) which require Java 11+ at runtime, so anyone on Java 8 would hit NoClassDefFoundError on the Jakarta classes regardless of the compile target. The ListOptions.java and test changes (Set.of → Collections.emptySet, etc.) were unnecessary since those are Java 9+ features that worked fine at Java 11.
Two alternatives:
A) Remove the explicit compiler override entirely and inherit ${java.server.minimum.version} (21) from the root pom. This module lives under rest/ and is consumed only by server-side modules (quarkus/runtime, operator, rest/admin-v2/services), so treating it as server code seems natural. Revert the ListOptions.java and test changes.
B) Restore <maven.compiler.release>11</maven.compiler.release> explicitly, matching the actual minimum imposed by the Jakarta EE 10 dependencies. Same result — revert the code changes.
Either way the ListOptions.java and test changes can be dropped since they were only needed to satisfy the Java 8 target.
There was a problem hiding this comment.
The only scenario where the comment below makes sense is if someone tries to use keycloak-admin-v2-api as a dependency in a project running on Java 8 or Java 11 outside Keycloak.
That's a realistic scenario, it might be used with the Java Admin Client that supports Java as old as 8.
| === OpenJDK 17 support removed | ||
|
|
||
| Keycloak server no longer supports running on OpenJDK 17, and the minimum supported version is now OpenJDK 21. | ||
|
|
There was a problem hiding this comment.
Suggestion: the upgrading guide could help users assess impact with a few lines. But if you would like to keep things concise, that's not a problem. Something like:
=== OpenJDK 17 support removed
Keycloak server no longer supports running on OpenJDK 17, and the minimum supported version is now OpenJDK 21.
The official container image already uses OpenJDK 21 and is not affected by this change.
Client libraries (`keycloak-admin-client`, `keycloak-authz-client`) continue to support Java 8.
FIPS 140-2 deployments no longer need the `kc.java.security` file or the manual `XMLDSig` provider configuration that was required with older OpenJDK 17 versions.
vmuzikar
left a comment
There was a problem hiding this comment.
Added some more comments. On top of that, there are a few more remaining issues.
- Threads Guide still contains Java 17 related paragraph.
testsuite/integration-arquillian/tests/pom.xml:431,:1422andAbstractQuarkusDeployableContainer.java:451– still reference the deletedkc.java.securityand pass it as-Djava.security.properties
| == Other restrictions | ||
|
|
||
| To have SAML working, make sure that a `XMLDSig` security provider is available in your security providers. | ||
| To have Kerberos working, make sure that a `SunJGSS` security provider is available. In FIPS enabled RHEL 9 in OpenJDK 21, the `XMLDSig` security provider may be already enabled |
There was a problem hiding this comment.
XMLDSig still needs to be explicitly enabled on FIPS. We need to adjust the docs.
| // BCFIPS require "SecureRandom.getInstanceStrong" to be available. But it may not be available on RHEL 8 on OpenJDK 17 due the https://bugzilla.redhat.com/show_bug.cgi?id=2155060 | ||
| private void checkSecureRandom(Runnable insertBcFipsProvider) { | ||
| try { | ||
| SecureRandom sr = SecureRandom.getInstanceStrong(); |
There was a problem hiding this comment.
AI claims SecureRandom.getInstanceStrong() is not enabled in true FIPS environment. That our CI misses it because the the kernel is not switched to FIPS, hence JDK is not switched to true FIPS mode either.
I think we might need some help from @mposolda on this.
Alternatively we could just revert this change to unblock Java 17 deprecation and tackle this clean up as a follow-up. That would be my preferred approach.
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <properties> | ||
| <!-- this property prevents the warning "WARN FilenoUtil: Native subprocess control requires open access" when using JRuby for the unit tests on JDK17 --> |
There was a problem hiding this comment.
Actually, this is still needed in the end even on later JDKs. Sorry I was not clear in my previous review that here only we just need to update the comment.
| * When isImplicitJreTruststore is true, password and provider are always null. | ||
| */ | ||
| private static KeyStore loadDefaultTruststore(String path, String type, String password, String provider, boolean isImplicitJreTruststore) { | ||
| private static KeyStore loadDefaultTruststore(String path, String type, String password, String provider) { |
There was a problem hiding this comment.
We don't actually need this wrapper any more...

Closes #52369
Signed-off-by: stianst [email protected]