Hello,
I`m trying to set BASIC Authentication on HTTP component (camel ver.
2.11.0).
I know that I can use header settings like this one:
.setHeader("Authorization", constant("Basic base64string")) and it works
fine.
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"
class="org.apache.camel.component.http.BasicAuthenticationHttpClientConfigurer">
<constructor-arg index="0" value="false"/>
<constructor-arg index="1" value="${user}"/>
<constructor-arg index="2" value="${password}"/>
</bean>
and in route:
.to("http://{{server}}:{{port}}/{{address}}?httpClientConfigurerRef=myHttpConfig")
I got an error:
INFO - basic authentication scheme selected
INFO - No credentials available for BASIC 'WSMAN'@172.24.40.110:5985
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://172.24.40.110:5985/wsman 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>
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="myContext"/>
<property name="httpConfiguration" ref="myAuth"/>
</bean>
and in route:
.to("http://{{server}}:{{port}}/{{address}}")
I got an error:
INFO - Basic authentication scheme selected
java.io.IOException: Server returned HTTP response code: 400 for URL:
http://172.24.40.110:5985/wsman
What is the correct configuration for http basic authentication?
Thanks for any advice.
--
View this message in context:
http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229.html
Sent from the Camel - Users mailing list archive at Nabble.com.