You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rohan Emmanuel <ro...@gmail.com> on 2025/03/10 13:19:28 UTC

sslcontextparameters for HTTP component

hi ,
i am trying to configure SSL context parameters using YAML dsl. I am not
able to configure it.  can anyone point me the sample configuration , i am
not able to find documentation for the YAML dsl. any pointers would be
appreciated.
YAML Snippet below for your reference, here how to configure the custom SSL
bean using YAML configuration.?

- to:
            id: to-e5b0
            uri: https
            parameters:
              sslContextParameters: customssl
              httpUri: https://<secure_URL>/
              httpMethod: GET

-- 
Regards,
Rohan Emmanuel

Re: sslcontextparameters for HTTP component

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Try with

               sslContextParameters: #bean:customssl


On Mon, Mar 10, 2025 at 10:04 PM Rohan Emmanuel <ro...@gmail.com>
wrote:

> Thanks a lot for reply Ivan Kulaga.
>
> getting error saying cannot convert String to KeyStore type during start.
>
> : Could not find a suitable setter for property: keyStore as there isn't a
> setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type:
> java.lang.String to the required type: java.security.KeyStore
>
> any pointers would be appreciated .
> .i have created SSL context parameters
>
>    -
>
>    to:
>                id: to-e5b0
>                uri: https
>                parameters:
>                  sslContextParameters: customssl
>                  httpUri: https://<secure_URL>/
>                  httpMethod: GET-beans:
>    -
>
>    name: keystoreparam
>    type: org.apache.camel.support.jsse.KeyStoreParameters
>    properties:
>    keyStore:
>
>  "#file:C:\\gateway\\camel-examples-camel-examples-4.4.0\\main-yaml\\server-keystore.jks"
>    #keyStore: "#bean:ks"
>
>
>
>
>           password: changeit
>
>    - name: keymanagers
>    type: org.apache.camel.support.jsse.KeyManagersParameters
>    properties:
>    keyStore: "#bean:keystoreparam"
>    #keyStorePassword: keystore-password
>    #keyPassword: key-password
>
>    - name: trustManagers
>    type: org.apache.camel.support.jsse.TrustManagersParameters
>    properties:
>    #trustStore: classpath:/path/to/truststore.jks
>    #trustStorePassword: truststore-password
>    keyStore: "#bean:keystoreparam"
>
>    - name: customssl
>    type: org.apache.camel.support.jsse.SSLContextParameters
>    properties:
>    keyManagers: '#bean:keymanagers'
>    trustManagers: '#bean:trustManagers'
>    secureSocketProtocol: TLSv1.2
>    #secureRandomStrong: true
>
>    - name: x509
>    type: org.apache.hc.client5.http.ssl.NoopHostnameVerifier
>
>
> On Mon, Mar 10, 2025 at 7:17 PM Ivan Kulaga <
> kulagaivanandreevich@gmail.com>
> wrote:
>
> > Hello Rohan!
> >
> > You're moving in the right direction, apart from your configuration that
> > looks like that:
> > - to:
> >             id: to-e5b0
> >             uri: https
> >             parameters:
> >               sslContextParameters: customssl
> >               httpUri: https://<secure_URL>/
> >               httpMethod: GET
> >
> > you need to add to your *CamelContext* a bean of type
> > *SSLContextParameters*
> > with name *customssl*. The type is specified in the docs
> > <
> >
> https://camel.apache.org/components/4.10.x/http-component.html#_query_parameters
> > >
> > and the name of the bean should match what you have in YAML.
> > You can look up here
> > <
> >
> https://camel.apache.org/components/4.10.x/others/yaml-dsl.html#_defining_beans
> > >
> > how to add beans to *CamelContext *in YAML dsl, in your case it might
> look
> > like that:
> > - beans:
> >     - name: "customssl"
> >       type: "#class:my.class.implementing.SslContextParameters"
> >       properties:
> >         myProperty: "myValue"
> >
> > You can also open a post in zulipchat <https://camel.zulipchat.com/> if
> > you
> > have any further questions.
> >
> > Best regards,
> > Ivan Kulaga
> >
> >
> >
> > On Mon, Mar 10, 2025 at 6:20 PM Rohan Emmanuel <
> rohan.emmanuel07@gmail.com
> > >
> > wrote:
> >
> > > hi ,
> > > i am trying to configure SSL context parameters using YAML dsl. I am
> not
> > > able to configure it.  can anyone point me the sample configuration , i
> > am
> > > not able to find documentation for the YAML dsl. any pointers would be
> > > appreciated.
> > > YAML Snippet below for your reference, here how to configure the custom
> > SSL
> > > bean using YAML configuration.?
> > >
> > > - to:
> > >             id: to-e5b0
> > >             uri: https
> > >             parameters:
> > >               sslContextParameters: customssl
> > >               httpUri: https://<secure_URL>/
> > >               httpMethod: GET
> > >
> > > --
> > > Regards,
> > > Rohan Emmanuel
> > >
> >
>
>
> --
> Regards,
> Rohan Emmanuel
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: sslcontextparameters for HTTP component

Posted by Rohan Emmanuel <ro...@gmail.com>.
Thanks a lot for reply Ivan Kulaga.

getting error saying cannot convert String to KeyStore type during start.

: Could not find a suitable setter for property: keyStore as there isn't a
setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type:
java.lang.String to the required type: java.security.KeyStore

any pointers would be appreciated .
.i have created SSL context parameters

   -

   to:
               id: to-e5b0
               uri: https
               parameters:
                 sslContextParameters: customssl
                 httpUri: https://<secure_URL>/
                 httpMethod: GET-beans:
   -

   name: keystoreparam
   type: org.apache.camel.support.jsse.KeyStoreParameters
   properties:
   keyStore:
   "#file:C:\\gateway\\camel-examples-camel-examples-4.4.0\\main-yaml\\server-keystore.jks"
   #keyStore: "#bean:ks"




          password: changeit

   - name: keymanagers
   type: org.apache.camel.support.jsse.KeyManagersParameters
   properties:
   keyStore: "#bean:keystoreparam"
   #keyStorePassword: keystore-password
   #keyPassword: key-password

   - name: trustManagers
   type: org.apache.camel.support.jsse.TrustManagersParameters
   properties:
   #trustStore: classpath:/path/to/truststore.jks
   #trustStorePassword: truststore-password
   keyStore: "#bean:keystoreparam"

   - name: customssl
   type: org.apache.camel.support.jsse.SSLContextParameters
   properties:
   keyManagers: '#bean:keymanagers'
   trustManagers: '#bean:trustManagers'
   secureSocketProtocol: TLSv1.2
   #secureRandomStrong: true

   - name: x509
   type: org.apache.hc.client5.http.ssl.NoopHostnameVerifier


On Mon, Mar 10, 2025 at 7:17 PM Ivan Kulaga <ku...@gmail.com>
wrote:

> Hello Rohan!
>
> You're moving in the right direction, apart from your configuration that
> looks like that:
> - to:
>             id: to-e5b0
>             uri: https
>             parameters:
>               sslContextParameters: customssl
>               httpUri: https://<secure_URL>/
>               httpMethod: GET
>
> you need to add to your *CamelContext* a bean of type
> *SSLContextParameters*
> with name *customssl*. The type is specified in the docs
> <
> https://camel.apache.org/components/4.10.x/http-component.html#_query_parameters
> >
> and the name of the bean should match what you have in YAML.
> You can look up here
> <
> https://camel.apache.org/components/4.10.x/others/yaml-dsl.html#_defining_beans
> >
> how to add beans to *CamelContext *in YAML dsl, in your case it might look
> like that:
> - beans:
>     - name: "customssl"
>       type: "#class:my.class.implementing.SslContextParameters"
>       properties:
>         myProperty: "myValue"
>
> You can also open a post in zulipchat <https://camel.zulipchat.com/> if
> you
> have any further questions.
>
> Best regards,
> Ivan Kulaga
>
>
>
> On Mon, Mar 10, 2025 at 6:20 PM Rohan Emmanuel <rohan.emmanuel07@gmail.com
> >
> wrote:
>
> > hi ,
> > i am trying to configure SSL context parameters using YAML dsl. I am not
> > able to configure it.  can anyone point me the sample configuration , i
> am
> > not able to find documentation for the YAML dsl. any pointers would be
> > appreciated.
> > YAML Snippet below for your reference, here how to configure the custom
> SSL
> > bean using YAML configuration.?
> >
> > - to:
> >             id: to-e5b0
> >             uri: https
> >             parameters:
> >               sslContextParameters: customssl
> >               httpUri: https://<secure_URL>/
> >               httpMethod: GET
> >
> > --
> > Regards,
> > Rohan Emmanuel
> >
>


-- 
Regards,
Rohan Emmanuel

Re: sslcontextparameters for HTTP component

Posted by Ivan Kulaga <ku...@gmail.com>.
Hello Rohan!

You're moving in the right direction, apart from your configuration that
looks like that:
- to:
            id: to-e5b0
            uri: https
            parameters:
              sslContextParameters: customssl
              httpUri: https://<secure_URL>/
              httpMethod: GET

you need to add to your *CamelContext* a bean of type *SSLContextParameters*
with name *customssl*. The type is specified in the docs
<https://camel.apache.org/components/4.10.x/http-component.html#_query_parameters>
and the name of the bean should match what you have in YAML.
You can look up here
<https://camel.apache.org/components/4.10.x/others/yaml-dsl.html#_defining_beans>
how to add beans to *CamelContext *in YAML dsl, in your case it might look
like that:
- beans:
    - name: "customssl"
      type: "#class:my.class.implementing.SslContextParameters"
      properties:
        myProperty: "myValue"

You can also open a post in zulipchat <https://camel.zulipchat.com/> if you
have any further questions.

Best regards,
Ivan Kulaga



On Mon, Mar 10, 2025 at 6:20 PM Rohan Emmanuel <ro...@gmail.com>
wrote:

> hi ,
> i am trying to configure SSL context parameters using YAML dsl. I am not
> able to configure it.  can anyone point me the sample configuration , i am
> not able to find documentation for the YAML dsl. any pointers would be
> appreciated.
> YAML Snippet below for your reference, here how to configure the custom SSL
> bean using YAML configuration.?
>
> - to:
>             id: to-e5b0
>             uri: https
>             parameters:
>               sslContextParameters: customssl
>               httpUri: https://<secure_URL>/
>               httpMethod: GET
>
> --
> Regards,
> Rohan Emmanuel
>