davsclaus opened a new pull request, #30887: URL: https://github.com/apache/camel/pull/30887
CAMEL-22751: camel-grpc - a producer with negotiationType=TLS only needs a client key and certificate for mutual TLS JIRA: https://issues.apache.org/jira/browse/CAMEL-22751 ## Problem `GrpcProducer` required `keyCertChainResource` and `keyResource` whenever `negotiationType=TLS`. A producer could therefore not call a TLS server that does not ask for a client certificate (for example a gRPC API that authenticates with an API key header): starting the route failed with `keyCertChainResource must be specified`. As GOOGLE authentication requires TLS, it also forced a client certificate. ## Change - `GrpcProducer`: with TLS, the client key and certificate are configured only when both `keyCertChainResource` and `keyResource` are set (mutual TLS). Setting only one of them fails at startup with an error that names the missing option. The server is verified with `trustCertCollectionResource` when set, else with the default trust store of the JVM (no trust-all). The resource streams are now closed after reading, and a missing resource fails with `FileNotFoundException`. - The consumer (server) is unchanged: it still needs its own key and certificate, and still requires a client certificate (`ClientAuth.REQUIRE`). - Option descriptions of `keyCertChainResource`, `keyResource` and `trustCertCollectionResource` say which side needs them; the grpc docs table and a new producer example show TLS where only the server is authenticated. Metadata, catalog and endpoint DSL regenerated. ## Tests - New `GrpcProducerServerTlsTest`: a TLS server with `ClientAuth.NONE` (existing test certs). - a producer with only `trustCertCollectionResource` gets a reply (fails on main with `keyCertChainResource must be specified`); - a producer without `trustCertCollectionResource` fails the TLS handshake (`SSLHandshakeException`), showing the default trust store is used. - `GrpcProducerConfigurationTest`: GOOGLE authentication with TLS and no client key gets past the TLS setup and reports the missing `serviceAccountResource` (fails on main with `keyCertChainResource must be specified`); only `keyCertChainResource` or only `keyResource` fails with a clear error. - Mutual TLS still works: `GrpcProducerSecurityTest`, `GrpcConsumerSecurityTest`. - camel-grpc: 90 tests, 0 failures. ## Upgrade notes None: configurations that worked before work the same; only configurations that failed at startup now work. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
