Hi,

Not sure I follow (related to your previous message): are you using
servlet registration or camel-jetty ?

On camel-jetty, you can define a security handler.

Using servlet, you can always register a filter.

Regards
JB

On 03/02/2020 18:34, Gerald Kallas wrote:
> Dear community,
> 
> I've following REST API (see below).
> 
> How can I add a Basic Authentication to the REST API in Blueprint DSL? Any 
> hints are highly welcome.
> 
> Best
> - Gerald
> 
> Configuration XML ..
> 
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
> 
>       <reference id="httpService" 
> interface="org.osgi.service.http.HttpService"/>
> 
>       <bean id="camelHttpTransportServlet" 
> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
> 
>       <bean id="servlet" 
> class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
>         init-method="register"
>         destroy-method="unregister">
>               <property name="alias" value="/api"/>
>               <property name="httpService" ref="httpService"/>
>               <property name="servlet" ref="camelHttpTransportServlet"/>
>       </bean>
> 
> </blueprint>
> 
> .. and REST API ..
> 
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
> 
>       <camelContext id="isp.routes.RST" 
> xmlns="http://camel.apache.org/schema/blueprint"; streamCache="true">
> 
>               <restConfiguration component="servlet" bindingMode="json" 
> contextPath="/api" port="443">
>                       <dataFormatProperty key="prettyPrint" value="true"/>
>               </restConfiguration>
> 
>               <rest path="/say">
>                       <get uri="/hello" consumes="application/json" 
> id="isp.routes.RST001">
>                               <to uri="direct:hello"/>
>                       </get>
>                       <get uri="/bye" consumes="application/json" 
> id="isp.routes.RST002">
>                               <to uri="direct:bye"/>
>                       </get>
>               </rest>
> 
>               <route id="isp.routes.RST003">
>                       <from uri="direct:hello"/>
>                       <setHeader name="Content-Type">
>                               <constant>application/json</constant>
>                       </setHeader>
>                       <transform>
>                               <constant>{"text": "Hello World"}</constant>
>                       </transform>
>               </route>
> 
>               <route id="isp.routes.RST004">
>                       <from uri="direct:bye"/>
>                       <setHeader name="Content-Type">
>                               <constant>application/json</constant>
>                       </setHeader>
>                       <transform>
>                               <constant>{"text": "Bye World"}</constant>
>                       </transform>
>               </route>
> 
>       </camelContext>
> 
> </blueprint>
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to