You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by zied123456 <zi...@gmail.com> on 2015/12/22 10:47:04 UTC

Camel CXF - Security (Authentication)


I created a webservice with apache camel using CXF component as bellow :

blueprint.xml:

  <bean class="ngtrend.ws.Testws"/>
  
  <cxf:rsServer id="rsServer" address="http://localhost:9050/route"
    serviceClass="ngtrend.ws.Testws"     />
  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route id="timerToLog">
      <from uri="cxfrs://bean://rsServer"/>
      <to uri="bean:ngtrend.ws.HelloBean?method=test(Exchange)"/>
      <log message="${body}"/>
    </route>
  </camelContext>

Testws.java:

public class Testws {
    @GET
    @Path("/test/{id}")
    @Produces("application/xml")
    //@Consumes("text/xml")
    public Integer getAssets(@PathParam("id") int id){
        return null;
    }
}

and I would like to secure it forcing the customer to send ( or enter on a
dialog box if using a browser) login and password (BASIC Http
authentication). How can i make this configuration ?




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Security-Authentication-tp5775347.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF - Security (Authentication)

Posted by Mary Cochran <mc...@redhat.com>.
If you are looking for an example of the CXF with Basic Auth this is one myself and a co-worker put together: https://github.com/rhtconsulting/fuse-quickstarts/tree/jboss-fuse-6.2.1/karaf/soap_secure

Mary Cochran
Red Hat Consulting
Email: mcochran@redhat.com | c: 419-543-0531 | http://www.redhat.com 

----- Original Message -----
From: "Sergey Beryozkin" <sb...@gmail.com>
To: users@camel.apache.org
Sent: Wednesday, December 23, 2015 8:50:15 AM
Subject: Re: Camel CXF - Security (Authentication)

Hi

One way to control it can be to register 
org.apache.cxf.jaxrs.security.JAASAuthenticationFilter - it will report 
401. Or register a custom filter that will do it. Register filters in 
cxf:rsServer/cxf:providers.

Alternatively you might want to experiment with configuring the 
underlying container to do it for you.
When CXFRS endpoint with an absolute address is used, it is CXF Jetty 
transport that supports it, so in this case may be you can configure CXF 
Jetty transport somehow:

http://cxf.apache.org/docs/jetty-configuration.html

Perhaps you might also be able to combine Camel Servlet with CXF RS 
endpoint via a camel transport

Sergey

On 22/12/15 09:47, zied123456 wrote:
>
>
> I created a webservice with apache camel using CXF component as bellow :
>
> blueprint.xml:
>
>    <bean class="ngtrend.ws.Testws"/>
>
>    <cxf:rsServer id="rsServer" address="http://localhost:9050/route"
>      serviceClass="ngtrend.ws.Testws"     />
>    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>      <route id="timerToLog">
>        <from uri="cxfrs://bean://rsServer"/>
>        <to uri="bean:ngtrend.ws.HelloBean?method=test(Exchange)"/>
>        <log message="${body}"/>
>      </route>
>    </camelContext>
>
> Testws.java:
>
> public class Testws {
>      @GET
>      @Path("/test/{id}")
>      @Produces("application/xml")
>      //@Consumes("text/xml")
>      public Integer getAssets(@PathParam("id") int id){
>          return null;
>      }
> }
>
> and I would like to secure it forcing the customer to send ( or enter on a
> dialog box if using a browser) login and password (BASIC Http
> authentication). How can i make this configuration ?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Security-Authentication-tp5775347.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: Camel CXF - Security (Authentication)

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

One way to control it can be to register 
org.apache.cxf.jaxrs.security.JAASAuthenticationFilter - it will report 
401. Or register a custom filter that will do it. Register filters in 
cxf:rsServer/cxf:providers.

Alternatively you might want to experiment with configuring the 
underlying container to do it for you.
When CXFRS endpoint with an absolute address is used, it is CXF Jetty 
transport that supports it, so in this case may be you can configure CXF 
Jetty transport somehow:

http://cxf.apache.org/docs/jetty-configuration.html

Perhaps you might also be able to combine Camel Servlet with CXF RS 
endpoint via a camel transport

Sergey

On 22/12/15 09:47, zied123456 wrote:
>
>
> I created a webservice with apache camel using CXF component as bellow :
>
> blueprint.xml:
>
>    <bean class="ngtrend.ws.Testws"/>
>
>    <cxf:rsServer id="rsServer" address="http://localhost:9050/route"
>      serviceClass="ngtrend.ws.Testws"     />
>    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>      <route id="timerToLog">
>        <from uri="cxfrs://bean://rsServer"/>
>        <to uri="bean:ngtrend.ws.HelloBean?method=test(Exchange)"/>
>        <log message="${body}"/>
>      </route>
>    </camelContext>
>
> Testws.java:
>
> public class Testws {
>      @GET
>      @Path("/test/{id}")
>      @Produces("application/xml")
>      //@Consumes("text/xml")
>      public Integer getAssets(@PathParam("id") int id){
>          return null;
>      }
> }
>
> and I would like to secure it forcing the customer to send ( or enter on a
> dialog box if using a browser) login and password (BASIC Http
> authentication). How can i make this configuration ?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Security-Authentication-tp5775347.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/