You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Gábor SEBESTYÉN <se...@gmail.com> on 2005/07/05 10:38:52 UTC
HttpClient NOT to use NTLM
If I create AuthScope with ANY_SCHEME (or null or whaterver)
HttpClient theoretically will chose its best how to authenticate
itself (is it able to detect proxy server capabilities?).
Question: what should I set as parameter to avoid using NTLM and
force HttpClient to use basic uname/pwd authentication?
Thanks,
Gábor
"ALERT! Windows not found!
[C]heers, [P]arty or [D]ance?"
Re: Squid vs HttpClient
Posted by Michael Becke <mb...@gmail.com>.
Difficult to say. A wire log might help. Having a look at the proxy
logs may also be useful.
Mike
On 7/5/05, Gábor SEBESTYÉN <se...@gmail.com> wrote:
> Squid hates me. More precisely, I want to connect a squid proxy with
> basic authentication and it refuses to accept me.
> The code:
>
> Map conf = (Map) Globals.getGlobals().get("proxy.current");
> if (conf != null) {
> String proxyHost = (String) conf.get("host");
> int proxyPort = ((Integer) conf.get("port")).intValue();
> String user = (String) conf.get("user");
> String pwd = (String) conf.get("passwd");
>
> client.getHostConfiguration().setProxy(proxyHost,
> proxyPort);
> if (user != null && pwd != null) {
> client.getState().setProxyCredentials(
> new AuthScope(proxyHost, proxyPort,
> org.apache.commons.httpclient.auth.AuthPolicy.BASIC),
> new UsernamePasswordCredentials(user, pwd));
> }
> }
>
> The result:
>
> Java(TM) Plug-in: Version 1.4.2_07
> Using JRE version 1.4.2_07 Java HotSpot(TM) Client VM
> ----------------------------------------------------
> ...
> ----------------------------------------------------
> ...
> Jul 5, 2005 3:34:05 PM
> org.apache.commons.httpclient.auth.AuthChallengeProcessor
> selectAuthScheme
> INFO: basic authentication scheme selected
> Jul 5, 2005 3:34:05 PM
> org.apache.commons.httpclient.HttpMethodDirector
> processProxyAuthChallenge
> INFO: No credentials available for BASIC 'Squid proxy-caching web
> server'@core0:3128
> Method failed: HTTP/1.0 407 Proxy Authentication Required
> java.lang.NullPointerException
> at com.netforum.talk2me.comm.CommController.login
> (CommController.java:227)
> at com.netforum.talk2me.OperatorApplet.start(OperatorApplet.java:
> 116)
> at sun.applet.AppletPanel.run(AppletPanel.java:391)
> at java.lang.Thread.run(Thread.java:552)
> java.lang.NullPointerException
> at com.netforum.talk2me.comm.CommController.login
> (CommController.java:227)
> at com.netforum.talk2me.OperatorApplet.start(OperatorApplet.java:
> 116)
> at sun.applet.AppletPanel.run(AppletPanel.java:391)
> at java.lang.Thread.run(Thread.java:552)
>
> That is, squid doesn't want to let me in. I doublechecked username /
> password and it's correct.
> What's my fault? :D
>
> Gábor
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Squid vs HttpClient
Posted by Gábor SEBESTYÉN <se...@gmail.com>.
Squid hates me. More precisely, I want to connect a squid proxy with
basic authentication and it refuses to accept me.
The code:
Map conf = (Map) Globals.getGlobals().get("proxy.current");
if (conf != null) {
String proxyHost = (String) conf.get("host");
int proxyPort = ((Integer) conf.get("port")).intValue();
String user = (String) conf.get("user");
String pwd = (String) conf.get("passwd");
client.getHostConfiguration().setProxy(proxyHost,
proxyPort);
if (user != null && pwd != null) {
client.getState().setProxyCredentials(
new AuthScope(proxyHost, proxyPort,
org.apache.commons.httpclient.auth.AuthPolicy.BASIC),
new UsernamePasswordCredentials(user, pwd));
}
}
The result:
Java(TM) Plug-in: Version 1.4.2_07
Using JRE version 1.4.2_07 Java HotSpot(TM) Client VM
----------------------------------------------------
...
----------------------------------------------------
...
Jul 5, 2005 3:34:05 PM
org.apache.commons.httpclient.auth.AuthChallengeProcessor
selectAuthScheme
INFO: basic authentication scheme selected
Jul 5, 2005 3:34:05 PM
org.apache.commons.httpclient.HttpMethodDirector
processProxyAuthChallenge
INFO: No credentials available for BASIC 'Squid proxy-caching web
server'@core0:3128
Method failed: HTTP/1.0 407 Proxy Authentication Required
java.lang.NullPointerException
at com.netforum.talk2me.comm.CommController.login
(CommController.java:227)
at com.netforum.talk2me.OperatorApplet.start(OperatorApplet.java:
116)
at sun.applet.AppletPanel.run(AppletPanel.java:391)
at java.lang.Thread.run(Thread.java:552)
java.lang.NullPointerException
at com.netforum.talk2me.comm.CommController.login
(CommController.java:227)
at com.netforum.talk2me.OperatorApplet.start(OperatorApplet.java:
116)
at sun.applet.AppletPanel.run(AppletPanel.java:391)
at java.lang.Thread.run(Thread.java:552)
That is, squid doesn't want to let me in. I doublechecked username /
password and it's correct.
What's my fault? :D
Gábor
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org