Certificate Based Authentication Using Camel Jetty

973 views Asked by At

I have a issue where i have to pass client certificate for the Authentication purpose.

My code:

   <camel:sslContextParameters id="sslContextParameters">

     <camel:keyManagers keyPassword="indigo">
        <camel:keyStore resource="/home/sahil/Demo/new.jks" password="changeit"/>
    </camel:keyManagers>

    <camel:trustManagers>
     <camel:keyStore resource="/home/sahil/Demo/123.jks" password="changeit"/>
       </camel:trustManagers>
        <camel:serverParameters clientAuthentication="WANT" />    
</camel:sslContextParameters> <to uri="jetty:https://xx.x.xx/activate"/>

Every time i hit this service i get a error

2017/09/01 15:32:38 [info] 3934#3934: *11 client sent no required SSL certificate while reading client request headers,

And when i hit the URl with curl command and pass the client certificate it is showing success

1

There are 1 answers

2
lahu89 On

The reference to your contextParameter is missing in your jetti-uri. It should look like:

<to uri="jetty:https://xx.x.xx/activate?sslContextParametersRef=sslContextParameters"/>

This is from the Camel Wiki:

Spring DSL based configuration of endpoint

xml<camel:sslContextParameters id="sslContextParameters"><camel:keyManagers keyPassword="keyPassword"> <camel:keyStore resource="/users/home/server/keystore.jks" password="keystorePassword"/> </camel:keyManagers> </camel:sslContextParameters> <to uri="jetty:https://127.0.0.1/mail/?sslContextParametersRef=sslContextParameters"/>