camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin11 <>
Subject HTTP Basic Authentication
Date Fri, 25 Oct 2013 22:30:37 GMT

I`m trying to set BASIC Authentication on HTTP component (camel ver.
I know that I can use header settings like this one:
.setHeader("Authorization", constant("Basic base64string")) and it works

But I`m looking for more elegant way to setup basic auth. Something like in
CXF spring bean and http:authorization properties.

--------- 1st test -------
So I tried to use HttpClientConfigurer:
<bean id="myHttpConfig"
    <constructor-arg index="0" value="false"/>
    <constructor-arg index="1" value="${user}"/>
    <constructor-arg index="2" value="${password}"/>

and in route:

I got an error:
INFO  - basic authentication scheme selected
INFO  - No credentials available for BASIC 'WSMAN'@
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking with statusCode: 401

Why is not set BASIC credentials?

--------- 2nd test -------
I also try other way:
<bean id="myAuth" class="org.apache.camel.component.http.HttpConfiguration">
    <property name="authMethod" value="Basic"/>
    <property name="authUsername" value="${user}"/>
    <property name="authPassword" value="${password}"/>

<bean id="http" class="org.apache.camel.component.http.HttpComponent">
    <property name="camelContext" ref="myContext"/>
    <property name="httpConfiguration" ref="myAuth"/>

and in route:

I got an error:
INFO  - Basic authentication scheme selected Server returned HTTP response code: 400 for URL:

What is the correct configuration for http basic authentication?

Thanks for any advice.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message