Raul G
Raul G

Reputation: 493

How do I configure sslContextParameters for camel-undertow to use with the rest DSL?

currently, I'm using camel-jetty for setting up the rest DSL, it's pretty much straightforward, I create an SSLContextParameters object, and then pass it like this:

JettyHttpComponent jetty = context.getComponent("jetty", JettyHttpComponent.class);
jetty.setSslContextParameters(sslContextParameters);

and that's it, but in Undertow, there is no method whatsoever to do that, the only thing that is mentioned once in the documentation is that it supports the sslContextParameters option, but there's no method or anything to set such option.

How do I assign my sslContextParameters object to the Undertow component so that I can use SSL connections with the rest DSL?

By the way, I have tried setting an UndertowComponent object and adding the option as a component parameter, and also tried adding the option in EndpointProperties through restConfiguration() to no avail.

I have also browsed the github source code for 2.16.1, which is the latest in maven central, and I only see a reference to an ssl context in UndertowRegistry and the setSslContext setter is never even used anywhere!

Upvotes: 0

Views: 2217

Answers (2)

Ankit
Ankit

Reputation: 109

SSL context can be assigned in following way:

    UndertowComponent uc = new UndertowComponent(context);

    KeyStoreParameters trust_ksp = new KeyStoreParameters();
    trust_ksp.setResource("/cacerts.jks");
    trust_ksp.setPassword("changeit");
    TrustManagersParameters trustp = new TrustManagersParameters();
    trustp.setKeyStore(trust_ksp);

    SSLContextParameters scp = new SSLContextParameters();
    scp.setTrustManagers(trustp);
    uc.setSslContextParameters(scp);

Upvotes: 1

Claus Ibsen
Claus Ibsen

Reputation: 55535

You cannot set SSL on the component level on camel-undertow. I have logged a ticket to make this possible in upcoming release: https://issues.apache.org/jira/browse/CAMEL-9559

You would need to configure the SSL as a endpointProperty in the rest-dsl configuration. You can find more details at: http://camel.apache.org/rest-dsl. And you would need to add the sslContextParameters to the Camel registry beforehand, so the endpointProperty can lookup it by its id.

Upvotes: 1

Related Questions