You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Gerald Kallas - mailbox.org" <ca...@mailbox.org> on 2020/05/03 19:36:16 UTC

camel-servlet configuration of port, ssl, basic auth?

Dear community,

as camel-jetty underpinning securityHandler seems to lack of re-usability (https://issues.apache.org/jira/browse/KARAF-6700,https://issues.apache.org/jira/browse/CAMEL-15000) I'm going to setup a http consumer based on camel-servlet following https://camel.apache.org/components/latest/servlet-component.html(OSGi Blueprint).

I wonder if someone could share the experience how to define

- port number
- SSL properties
- basic auth properties

Thanks in advance
- Gerald

Re: camel-servlet configuration of port, ssl, basic auth?

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Gerald,

I used camel-servlet with the Karaf web container while ago for a customer (it worked fine, but it was pretty simple).

It can update (as it’s pretty old) and contribute a example with the features you mentioned.

Regards
JB

> Le 3 mai 2020 à 21:36, Gerald Kallas - mailbox.org <ca...@mailbox.org> a écrit :
> 
> Dear community,
> 
> as camel-jetty underpinning securityHandler seems to lack of re-usability (https://issues.apache.org/jira/browse/KARAF-6700,https://issues.apache.org/jira/browse/CAMEL-15000 <https://issues.apache.org/jira/browse/KARAF-6700,https://issues.apache.org/jira/browse/CAMEL-15000>) I'm going to setup a http consumer based on camel-servlet following https://camel.apache.org/components/latest/servlet-component.html <https://camel.apache.org/components/latest/servlet-component.html>(OSGi Blueprint).
> 
> I wonder if someone could share the experience how to define
> 
> - port number
> - SSL properties
> - basic auth properties
> 
> Thanks in advance
> - Gerald


RE: camel-servlet configuration of port, ssl, basic auth?

Posted by Gerald Kallas <ca...@mailbox.org>.
Hi JB, hi Stephan,

many thanks for your replies!

Let me describe our use case. We have a Docker Container with Karaf (4.2.7) exposing 2 ports (HTTP 8182, HTTPS 8444) for Camel Consumers based on the embedded Jetty Web Server. The SSL setup is working fine. All Camel Routes are defined in OSGi Blueprint.

For the different Camel Consumers we need

- Different endpoints on the same port (HTTP 8182 or HTTPS 8444) with different URIs (paths)
- HTTP Basic Authentication unique for every URI (path)

I started with Jetty configuration and have learned that a Security Handler in Jetty is bind to a port and must me unique. For this I tried to externalize the Security Handler in a dedicated Blueprint file and register it at OSGi Service Registry. The use in another Blueprint files causes an error and I've opened a JIRA issue for that
https://issues.apache.org/jira/browse/KARAF-6700

We came to the approach whether it could be work without this error based on Camel Servlet.

I think the use case (Camel HTTP Consumers on same port with different URIs, HTTPS and Basic Authentication unique for each Camel Consumer) is quite common. So I wonder if either the error with the Jetty Security Handler registration and re-use could be solved or an approach based on Camel Servlet would work easier.

Many thanks in advance for some help in this case. It's quite important to get our customer scenario running.

Best
- Gerald

> Siano, Stephan <st...@sap.com> hat am 4. Mai 2020 09:03 geschrieben:
> 
> 
> Hi Gerald,
> 
> the camel servlet component contains a CamelHttpTransportServlet. You need to register this Servlet with the web container (once per container, not once per endpoint).
> 
> There is also a OsgiServletRegisterer in this bundle, which can register the servlet with the OSGi HTTP service, which you can use, or you can create a WAB with a web.xml for that.
> 
> You do the port and the HTTPS configuration with the embedded web container in Karaf (e.g. the Jetty server). Authentication is configured for the web context (which might be a bit tricky for a HTTP service context, which is why the web.xml path might be easier).
> 
> Best regards
> Stephan
> 
> From: Gerald Kallas - mailbox.org <ca...@mailbox.org> 
> Sent: Sonntag, 3. Mai 2020 21:36
> To: user@karaf.apache.org
> Subject: camel-servlet configuration of port, ssl, basic auth?
> 
> Dear community,
> 
> as camel-jetty underpinning securityHandler seems to lack of re-usability (https://issues.apache.org/jira/browse/KARAF-6700,https://issues.apache.org/jira/browse/CAMEL-15000 (https://issues.apache.org/jira/browse/KARAF-6700,https:/issues.apache.org/jira/browse/CAMEL-15000)) I'm going to setup a http consumer based on camel-servlet following https://camel.apache.org/components/latest/servlet-component.html(OSGi Blueprint).
> 
> I wonder if someone could share the experience how to define
> 
> - port number
> - SSL properties
> - basic auth properties
> 
> Thanks in advance
> - Gerald

RE: camel-servlet configuration of port, ssl, basic auth?

Posted by "Siano, Stephan" <st...@sap.com>.
Hi Gerald,

the camel servlet component contains a CamelHttpTransportServlet. You need to register this Servlet with the web container (once per container, not once per endpoint).

There is also a OsgiServletRegisterer in this bundle, which can register the servlet with the OSGi HTTP service, which you can use, or you can create a WAB with a web.xml for that.

You do the port and the HTTPS configuration with the embedded web container in Karaf (e.g. the Jetty server). Authentication is configured for the web context (which might be a bit tricky for a HTTP service context, which is why the web.xml path might be easier).

Best regards
Stephan

From: Gerald Kallas - mailbox.org <ca...@mailbox.org>
Sent: Sonntag, 3. Mai 2020 21:36
To: user@karaf.apache.org
Subject: camel-servlet configuration of port, ssl, basic auth?

Dear community,

as camel-jetty underpinning securityHandler seems to lack of re-usability (https://issues.apache.org/jira/browse/KARAF-6700,https://issues.apache.org/jira/browse/CAMEL-15000<https://issues.apache.org/jira/browse/KARAF-6700,https:/issues.apache.org/jira/browse/CAMEL-15000>) I'm going to setup a http consumer based on camel-servlet following https://camel.apache.org/components/latest/servlet-component.html(OSGi Blueprint).

I wonder if someone could share the experience how to define

- port number
- SSL properties
- basic auth properties

Thanks in advance
- Gerald