urunni88 opened a new pull request, #30151: URL: https://github.com/apache/camel/pull/30151
# Description [CAMEL-26920](https://issues.apache.org/jira/browse/CAMEL-26920): Vert.x only loads the keys of a JWT keystore whose alias is the name of a JWT algorithm. In Vert.x 5.2.3, `JWK.load(KeyStore, ...)` looks up a fixed list of aliases: `HS256`, `HS384`, `HS512`, `RS256`, `RS384`, `RS512`, `ES256K`, `ES256`, `ES384`, `ES512`. A keystore with a valid key under another alias (such as `keycloak`) loads fine, the server starts, and then every signed token is rejected with HTTP 401 (`JWT is in unsecured mode but token is signed`). Changes: - `JWTAuthenticationConfigurer` now opens the configured keystore at startup (for both `camel.server` and `camel.management`) and logs a warning when none of its aliases is one of these names. The warning names the property, the aliases found and the expected names, and shows the `keytool -changealias` workaround. The match ignores case, as PKCS12 and JKS store aliases in lower case. If the keystore cannot be opened, the check is skipped and Vert.x reports the problem as before. - `platform-http-main.adoc` (and its catalog copy) has a new "Keystore aliases" section in "JWT authentication". I went with a warning rather than failing fast, as noted on the JIRA. Happy to change it to fail fast if that's preferred. Test: `JWTKeystoreAliasesTest` checks the alias check with in-memory PKCS12 keystores: no warning for an algorithm alias (stored in lower case), no warning when one of several aliases matches, and a warning for `keycloak` alone. All 47 tests of camel-platform-http-main pass, and the existing JWT tests, which start a server with a real keystore, log no warning. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with the help of Claude (Anthropic), credited with a `Co-authored-by` trailer in the commit. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
