When I use basic authentication with http(s) component I can't set
user/password in HTTP_URI header. Authentication work only if credentials
set in endpoint URI, e.g.:
...
.setHeader("CamelHttpMethod", constant("GET"))
.setHeader("CamelHttpUri", body().convertTo(String.class))
.to(ExchangePattern.InOut,
"https://localhost:8443?username=guest&password=guest")
It's code will work. Here uri get from previous message and user/password
from endpoint URI. If I remove user/password from endpoint URI it's dont
work (credentials from HTTP_URI dont send to http server):
...
.setHeader("CamelHttpMethod", constant("GET"))
.setHeader("CamelHttpUri", body().convertTo(String.class))
.to(ExchangePattern.InOut, "https://localhost:8443")
Log:
...
[read 4: seda://processelements] HttpMethodBase DEBUG Adding
Host request header
[read 4: seda://processelements] header DEBUG >>
"User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
[read 4: seda://processelements] header DEBUG >>
"Host: localhost[\r][\n]"
[read 4: seda://processelements] header DEBUG >>
"[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"HTTP/1.1 401 Unauthorized[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"HTTP/1.1 401 Unauthorized[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Server: Apache-Coyote/1.1[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Pragma: No-cache[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Cache-Control: no-cache[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Expires: Thu, 01 Jan 1970 03:00:00 MSK[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"WWW-Authenticate: Basic realm="localhost:443"[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Content-Type: text/html;charset=utf-8[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Content-Length: 954[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"Date: Tue, 17 Nov 2009 23:45:22 GMT[\r][\n]"
[read 4: seda://processelements] header DEBUG <<
"[\r][\n]"
[read 4: seda://processelements] HttpMethodDirector DEBUG
Authorization required
[read 4: seda://processelements] AuthChallengeProcessor DEBUG
Supported authentication schemes in the order of preference: [ntlm, digest,
basic]
[read 4: seda://processelements] AuthChallengeProcessor DEBUG
Challenge for ntlm authentication scheme not available
[read 4: seda://processelements] AuthChallengeProcessor DEBUG
Challenge for digest authentication scheme not available
[read 4: seda://processelements] AuthChallengeProcessor INFO basic
authentication scheme selected
[read 4: seda://processelements] AuthChallengeProcessor DEBUG Using
authentication scheme: basic
[read 4: seda://processelements] AuthChallengeProcessor DEBUG
Authorization challenge processed
[read 4: seda://processelements] HttpMethodDirector DEBUG
Authentication scope: BASIC 'localhost:443'@localhost:8443
[read 4: seda://processelements] HttpMethodDirector DEBUG
Credentials required
[read 4: seda://processelements] HttpMethodDirector DEBUG
Credentials provider not available
[read 4: seda://processelements] HttpMethodDirector INFO No
credentials available for BASIC 'localhost:443'@localhost:8443
[read 4: seda://processelements] HttpProducer DEBUG Http
responseCode: 401
...
This is normal? May be any workaround, when I dont need to set user/password
in code?
camel-version: 2.0-M3
Regards,
Ernold Vasiliev
--
View this message in context:
http://old.nabble.com/http-component-with-basic-authentication-when-use-HTTP_URI-tp26399992p26399992.html
Sent from the Camel - Users mailing list archive at Nabble.com.