2
votes

I use Apache Camel 2.17.1 and I have some problems in setting up the SSL client authentication on Jetty component (http://camel.apache.org/jetty.html). The first part with the server SSL runs smoothly (setting up the server keystore and access an HTTPS endpoint from the browser). Now I try to enrich the application by adding another route (with a different http port) where the client certificate is required.

From the documentation, this can be achieved through, since the SSL properties aren't exposed directly by Camel:

<bean id="jetty" class="org.apache.camel.component.jetty.JettyHttpComponent">
<property name="sslSocketConnectors">
    <map>
        <entry key="8043">
            <bean class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
                <property name="password"value="..."/>
                <property name="keyPassword"value="..."/>
                <property name="keystore"value="..."/>
                <property name="needClientAuth"value="..."/>
                <property name="truststore"value="..."/>
            </bean>
        </entry>
    </map>
</property>

It seams like the documentation was not updated, because these field names doesn't exist anymore in SslContextFactory. I manage to find other candidates, but got the error:

"org.eclipse.jetty.server.ssl.SslSelectChannelConnector" class doesn't exist anymore.
The JettyHttpComponent.setSslSocketConnectors() method accepts Connector interface objects. 

Could someone help me in finding a solution based on the newer versions of the Apache Camel (like 2.17)?

1
Looks like Camel 2.17 is using the newer Jetty 9 Connectors and the documentation hasn't been updated for it. (Note: SslSelectChannelConnector is an old class for Jetty 8 and older)Joakim Erdfelt

1 Answers

0
votes

Have you tried using the alternative approach, also mentioned in the documentation:

<camel:sslContextParameters id="sslContextParameters">
    <camel:keyManagers keyPassword="keyPassword">
        <camel:keyStore 
          resource="/users/home/server/keystore.jks" 
          password="keystorePassword"/>
    </camel:keyManagers>
</camel:sslContextParameters>

<from uri="jetty:https://127.0.0.1/mail/?sslContextParametersRef=sslContextParameters"/>

Granted, it requires you to specify the sslContextParametersRef parameter in your URIs but it should work.