CAMEL-23525: Add optional JWT issuer and audience claim validation#23389
Conversation
davsclaus
left a comment
There was a problem hiding this comment.
Nice addition — the implementation is clean and the test coverage is solid.
Minor observations:
-
Field ordering: In both
HttpServerConfigurationPropertiesandHttpManagementServerConfigurationProperties, the two new fields (jwtAudience,jwtIssuer) are interleaved with the existing keystore fields rather than grouped together. Consider placing them together (both before or both after the keystore trio) for readability. -
Upgrade guide: Per project conventions, new user-visible configuration properties should get a brief mention in
camel-4x-upgrade-guide-4_21.adoc. Since these are purely additive (no behavioral change when unset), this is minor.
Everything else looks good — backwards compatibility is preserved, tests cover positive and negative paths, docs and generated metadata are updated.
This review does not replace specialized tools like CodeRabbit or SonarCloud.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
When something is assigned, you should ask if the assignee want to leave the issue to you. Thanks for doing this, but next time look at the assignee. |
a0f047e to
0d5c1f8
Compare
The embedded HTTP server in camel-platform-http-main previously configured Vert.x JWTAuth with keystore parameters only. Tokens were verified for signature and the default exp/nbf claims, but the RFC 7519 registered claims iss (issuer) and aud (audience) were not validated. Add optional jwtIssuer and jwtAudience properties to both HttpServerConfigurationProperties (camel.server.*) and HttpManagementServerConfigurationProperties (camel.management.*). When either is set, attach a JWTOptions configured with the corresponding values to the JWTAuthOptions passed to JWTAuth.create. Behaviour is unchanged when both are unset. jwtAudience accepts a comma-separated list; a token is accepted if its aud claim matches any configured value.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
Build reactor — dependencies compiled but only changed modules were tested (4 modules)
|
|
@oscerd I am extremely sorry that I overlooked this. I am eager to contribute responsibly to the project! |
Description
The embedded HTTP server in
camel-platform-http-mainpreviously configured Vert.x JWTAuth with keystore parameters only. Tokens were verified for signature and the defaultexp/nbfclaims, but the RFC 7519 registered claimsiss(issuer) andaud(audience)were not validated.
This PR adds optional
jwtIssuerandjwtAudienceproperties to bothHttpServerConfigurationProperties(camel.server.*) andHttpManagementServerConfigurationProperties(camel.management.*). When either is set, aJWTOptionsconfigured with thecorresponding values is attached to the
JWTAuthOptionspassed toJWTAuth.create. Behaviour is unchanged when both are unset.jwtAudienceaccepts a comma-separated list; a token is accepted if itsaudclaim matches any configured value.Changes
JWTAuthenticationConfigurerbuilds a Vert.xJWTOptionsonly when either new property is set, and attaches it to theJWTAuthOptionspassed toJWTAuth.create.JWTIssuerAudienceAuthenticationMainHttpServerTestwith 6 cases: matching iss + first audience (200), matching iss + second audience (200), wrong issuer (401), wrong audience (401), missing audience claim (401), no token (401).JWTAuthenticationMainHttpServerTestandAuthenticationConfigurationMainHttpServerTestcontinue to pass, confirming backwards compatibility when neither property is set.platform-http-main.adoc.core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json) regenerated.Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.Claude Code on behalf of Vishal Nagaraj