You can set up the Authentication Properties dynamically just like this

        Map<String, Object> requestContext = new HashMap<String, Object>();
        requestContext.put(BindingProvider.USERNAME_PROPERTY, username);
        requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
        
exchange.getIn().setHeader(org.apache.cxf.endpoint.Client.REQUEST_CONTEXT , 
requestContext);

You can also setup the http conduit information in the spring configuration 
like this

<conduit name="{http://example.com/}HelloWorldServicePort.http-conduit";
  xmlns:sec="http://cxf.apache.org/configuration/security";
  xmlns="http://cxf.apache.org/transports/http/configuration";>
  <authorization>
     <sec:UserName>myuser</sec:UserName>
     <sec:Password>mypasswd</sec:Password>
     <sec:AuthorizationType>Basic</sec:AuthorizationType>
  </authorization>
</conduit>

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 27, 2014 at 7:23:23 PM, m.go (matthias.goeld...@googlemail.com) 
wrote:
> Hi,
>  
> I'm using camel v2.12.3.
> I have a route running within JBoss EAP 6.1 like this (I'm not using spring
> configuration):
>  
> from("jms:queue:test")
> .to("cxfbean:testServiceWS");
>  
> The jms queue is located on another server and the message itself is
> providing some authentication information.
> The webservice (jax-ws) is secured with basic authentication using JBoss
> security domain.
> Passing a message to the queue results in a 401 response, like expected.
> Is there a way to add auth information for the cxfbean invocation (for the
> RequestContext)?
>  
> Thanks for your help
>  
> Greetings
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/CxfBean-Authentication-tp5759699.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply via email to