Camel CXF - Security (Authentication)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel CXF - Security (Authentication)

zied123456
This post was updated on .
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 ?
Reply | Threaded
Open this post in threaded view
|

Re: Camel CXF - Security (Authentication)

Sergey Beryozkin
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/
Reply | Threaded
Open this post in threaded view
|

Re: Camel CXF - Security (Authentication)

Mary Cochran
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: [hidden email] | c: 419-543-0531 | http://www.redhat.com 

----- Original Message -----
From: "Sergey Beryozkin" <[hidden email]>
To: [hidden email]
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/