Camel http4 and url-encoded passwords being interpreted as separate arguments

前提是你 提交于 2019-12-07 06:33:42

问题


We've got an Apache Camel (2.13.2) app that uses http4 to communicate with a webserver, using NTLM for auth.

The endpoint is defined as (pseudo):

...
.to("http4://thegreat.server.com/uri?authUsername=" + user + "&authPassword=" + pass 
   + "&authenticationPreemptive=true&authMethod=NTLM&authDomain=DOMAIN&authHost=host")
.to("otherEndpoint");

This works well as long as the pass variable contains "non-special" chars.

However, if the pass contains for example "abcd&def" - Camel will intepret the ampersand as a query parameter separator, as it should.

But url encoding the ampersand (i.e "abcd%26def") makes no difference at all?

We still end up with Camel invoking the endpoint "http://thegreat.server.com/uri?authMethod=NTLM&def=", with a truncated password.

Is there something obvious we're missing out on, or does this kind of look like a bug?

Thanks.


回答1:


See the Camel documentation how to configure endpoint uris

  • http://camel.apache.org/how-do-i-configure-endpoints.html

There is a section that covers about passwords, eg you should use the RAW() syntax.

So it would be something a like

.to("http4://thegreat.server.com/uri?authUsername=" + user + "&authPassword=RAW(" + pass 
   + ")&authenticationPreemptive=true&authMethod=NTLM&authDomain=DOMAIN&authHost=host")
.to("otherEndpoint");


来源:https://stackoverflow.com/questions/25883501/camel-http4-and-url-encoded-passwords-being-interpreted-as-separate-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!