Re: Camel http - simple proxy authentication //error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Camel http - simple proxy authentication //error

chiochuan
Hi,

Are you using basic authentication?




https://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html

core-libs/java.net
Disable Basic authentication for HTTPS tunneling
In some environments, certain authentication schemes may be undesirable
when proxying HTTPS. Accordingly, the Basic authentication scheme has been
deactivated, by default, in the Oracle Java Runtime, by adding Basic to the
jdk.http.auth.tunneling.disabledSchemes networking property. Now, proxies
requiring Basic authentication when setting up a tunnel for HTTPS will no
longer succeed by default. If required, this authentication scheme can be
reactivated by removing Basic from the
jdk.http.auth.tunneling.disabledSchemes networking property, or by setting
a system property of the same name to "" ( empty ) on the command line.

Additionally, the jdk.http.auth.tunneling.disabledSchemes and
jdk.http.auth.proxying.disabledSchemes networking properties, and system
properties of the same name, can be used to disable other authentication
schemes that may be active when setting up a tunnel for HTTPS, or proxying
plain HTTP, respectively.
JDK-8160838 (not public)

Regards,



On Sun, 12 Jan 2020, 7:53 am Reji Mathews, <[hidden email]> wrote:

> Hello Camel Community
>
> I have a camel http producer endpoint configured as follows. I have an
> authenticated proxy server running at proxyserver.reji.com at port 8080.
> I have username and passwords configured below as well. Any help would save
> my day :)
>
> .to("
> http://host?throwExceptionOnFailure=true&proxyAuthMethod=Basic&proxyPort=8080&proxyHost=proxyserver.reji.com&proxyAuthUsername=reji&proxyAuthPassword=masked**").log("Response
> : ${body}").convertBodyTo(java.lang.String.class);
>
>
> However, looks like it's not working as expected and causing following
> stack trace.
>
> org.apache.commons.httpclient.auth.InvalidCredentialsException:
> Credentials cannot be used for NTLM authentication:
> org.apache.commons.httpclient.UsernamePasswordCredentials
>                 at
> org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:332)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpMethodDirector.authenticateProxy(HttpMethodDirector.java:320)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpMethodDirector.executeConnect(HttpMethodDirector.java:491)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:391)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
> [commons-httpclient-3.1.jar:na]
>                 at
> org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:287)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:169)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:213)
> [camel-http-common-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79)
> [camel-http-common-2.24.1.jar:2.24.1]
>                 at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
> [tomcat-embed-core-9.0.21.jar:9.0.21]
>                 at
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:876)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.server.Server.handle(Server.java:505)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:781)
> [jetty-util-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:917)
> [jetty-util-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
>
> 2020-01-11 18:45:53.044 - INFO 22368 --- [qtp637167753-36]
> o.a.c.httpclient.HttpMethodDirector     [lineno:781]     : Failure
> authenticating with NTLM <any realm>@proxyserver.reji.com:8080
> 2020-01-11 18:45:53.045 - WARN 22368 --- [qtp637167753-36]
> o.a.camel.component.http.HttpProducer   [lineno:349]     : Cannot close:
> Extracting response body. Reason: Stream closed
>
> java.io.IOException: Stream closed
>                 at
> java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
> ~[na:1.8.0_211]
>                 at
> java.io.BufferedInputStream.read(BufferedInputStream.java:336)
> ~[na:1.8.0_211]
>                 at
> org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:170)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:184)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.ChunkedInputStream.exhaustInputStream(ChunkedInputStream.java:369)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.ContentLengthInputStream.close(ContentLengthInputStream.java:118)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> java.io.FilterInputStream.close(FilterInputStream.java:181) ~[na:1.8.0_211]
>                 at
> org.apache.commons.httpclient.AutoCloseInputStream.notifyWatcher(AutoCloseInputStream.java:194)
> ~[commons-httpclient-3.1.jar:na]
>                 at
> org.apache.commons.httpclient.AutoCloseInputStream.close(AutoCloseInputStream.java:158)
> ~[commons-httpclient-3.1.jar:na]
>                 at org.apache.camel.util.IOHelper.close(IOHelper.java:342)
> ~[camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.component.http.HttpProducer.doExtractResponseBodyAsStream(HttpProducer.java:382)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.component.http.HttpProducer.extractResponseBody(HttpProducer.java:353)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:249)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:182)
> [camel-http-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
> [camel-core-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:213)
> [camel-http-common-2.24.1.jar:2.24.1]
>                 at
> org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79)
> [camel-http-common-2.24.1.jar:2.24.1]
>                 at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
> [tomcat-embed-core-9.0.21.jar:9.0.21]
>                 at
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:876)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
> [jetty-servlet-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.server.Server.handle(Server.java:505)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
> [jetty-server-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> [jetty-io-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:781)
> [jetty-util-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:917)
> [jetty-util-9.4.19.v20190610.jar:9.4.19.v20190610]
>                 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
>
> 2020-01-11 18:45:53.049 -ERROR 22368 --- [qtp637167753-36]
> c.h.camel.core.route.RouteErrorHandler  [lineno:33]     : Error has
> occurred:
> [java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:159),
> java.io.BufferedInputStream.available(BufferedInputStream.java:410),
> org.apache.commons.httpclient.ContentLengthInputStream.available(ContentLengthInputStream.java:213),
> java.io.FilterInputStream.available(FilterInputStream.java:168),
> org.apache.commons.httpclient.AutoCloseInputStream.available(AutoCloseInputStream.java:143),
> org.apache.camel.util.IOHelper.copy(IOHelper.java:184),
> org.apache.camel.util.IOHelper.copy(IOHelper.java:174),
> org.apache.camel.util.IOHelper.copy(IOHelper.java:170),
> org.apache.camel.component.http.HttpProducer.doExtractResponseBodyAsStream(HttpProducer.java:370),
> org.apache.camel.component.http.HttpProducer.extractResponseBody(HttpProducer.java:353),
> org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:249),
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:182),
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61),
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148),
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548),
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201),
> org.apache.camel.processor.Pipeline.process(Pipeline.java:138),
> org.apache.camel.processor.Pipeline.process(Pipeline.java:101),
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201),
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97),
> org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:213),
> org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79),
> javax.servlet.http.HttpServlet.service(HttpServlet.java:741),
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:876),
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542),
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205),
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480),
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144),
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132),
> org.eclipse.jetty.server.Server.handle(Server.java:505),
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370),
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267),
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305),
> org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103),
> org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117),
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:781),
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:917),
> java.lang.Thread.run(Thread.java:748)]
>