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>

Reply via email to