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 Sadashiv Patwary <SP...@axeda.com> on 2008/04/15 17:19:20 UTC
Help regarding the detecting NTLM proxy scheme
Hi all,
I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
Regards
shiva
RE: Help regarding the detecting NTLM proxy scheme
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2008-04-21 at 14:11 -0400, Sadashiv Patwary wrote:
> Oleg,
> Below is the piece of code.to get the scheme . I have a question Does scheme name is always returned irrespective whetherauthentication was success or faild.
This depends on the server
> Is there there any other way to get scheme name .
No, there is not.
Oleg
> All I want is to display message page to the user if the scheme used is ntlm.
> Regards
> shiva
>
> HttpClient httpClient = new HttpClient();
> if (logger.isDebugEnabled())
> {
> logger.debug("httpClient : " + httpClient);
> }
> method = new GetMethod(host);
> method.setDoAuthentication(true);
> executeMethod = httpClient.executeMethod(method);
> AuthState authstate = method.getProxyAuthState();
> boolean isNTLM = false;
> try
> {
> Map proxyChallenges = AuthChallengeParser.parseChallenges(
> method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
> if (proxyChallenges.isEmpty())
> {
> logger.debug("Proxy authentication challenge(s) not found");
> isNTLM = false;
> return isNTLM;
> }
> AuthScheme authscheme = null;
> /** Authentication processor */
> AuthChallengeProcessor authProcessor = null;
> authProcessor = new AuthChallengeProcessor(httpClientParams);
> authscheme = authProcessor.processChallenge(authstate, proxyChallenges);
> logger.info("Scheme name is " + authscheme.getSchemeName());
> if (authscheme.getSchemeName().equalsIgnoreCase("ntlm"))
> {
> logger.info("Proxy is using NTLMScheme");
> isNTLM = true;
> } else
> {
> if (logger.isDebugEnabled())
> {
> logger.debug("other proxy is " + authscheme.getSchemeName());
> }
> isNTLM = false;
> }
> }
>
> -----Original Message-----
> From: Sadashiv Patwary [mailto:SPatwary@axeda.com]
> Sent: Tuesday, April 15, 2008 1:51 PM
> To: HttpClient User Discussion
> Subject: RE: Help regarding the detecting NTLM proxy scheme
>
> Can you please suggest how can I retrieve the proxy scheme ?? .
>
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, April 15, 2008 1:45 PM
> To: HttpClient User Discussion
> Subject: Re: Help regarding the detecting NTLM proxy scheme
>
>
> On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> > Hi all,
> >
> > I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
> >
>
> No, it is not.
>
> Oleg
>
>
> > Regards
> >
> > shiva
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
RE: Help regarding the detecting NTLM proxy scheme
Posted by Sadashiv Patwary <SP...@axeda.com>.
Hi all,
May be my last mail was not clear. My requirement is if the scheme is NTLM I have to show message page.If other scheme's(either authenticated or unauthenticated) are used load a applet which will connect to a server and calculate latency. So while loading the applet I am using httpclient api's to make get request through the proxy .During that time I have to determine which scheme is being used and decide to load applet or not.
Regards
shiva
-----Original Message-----
From: Sadashiv Patwary [mailto:SPatwary@axeda.com]
Sent: Monday, April 21, 2008 2:12 PM
To: HttpClient User Discussion
Subject: RE: Help regarding the detecting NTLM proxy scheme
Oleg,
Below is the piece of code.to get the scheme . I have a question Does scheme name is always returned irrespective whetherauthentication was success or faild.Is there there any other way to get scheme name . All I want is to display message page to the user if the scheme used is ntlm.
Regards
shiva
HttpClient httpClient = new HttpClient();
if (logger.isDebugEnabled())
{
logger.debug("httpClient : " + httpClient);
}
method = new GetMethod(host);
method.setDoAuthentication(true);
executeMethod = httpClient.executeMethod(method);
AuthState authstate = method.getProxyAuthState();
boolean isNTLM = false;
try
{
Map proxyChallenges = AuthChallengeParser.parseChallenges(
method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty())
{
logger.debug("Proxy authentication challenge(s) not found");
isNTLM = false;
return isNTLM;
}
AuthScheme authscheme = null;
/** Authentication processor */
AuthChallengeProcessor authProcessor = null;
authProcessor = new AuthChallengeProcessor(httpClientParams);
authscheme = authProcessor.processChallenge(authstate, proxyChallenges);
logger.info("Scheme name is " + authscheme.getSchemeName());
if (authscheme.getSchemeName().equalsIgnoreCase("ntlm"))
{
logger.info("Proxy is using NTLMScheme");
isNTLM = true;
} else
{
if (logger.isDebugEnabled())
{
logger.debug("other proxy is " + authscheme.getSchemeName());
}
isNTLM = false;
}
}
-----Original Message-----
From: Sadashiv Patwary [mailto:SPatwary@axeda.com]
Sent: Tuesday, April 15, 2008 1:51 PM
To: HttpClient User Discussion
Subject: RE: Help regarding the detecting NTLM proxy scheme
Can you please suggest how can I retrieve the proxy scheme ?? .
-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Tuesday, April 15, 2008 1:45 PM
To: HttpClient User Discussion
Subject: Re: Help regarding the detecting NTLM proxy scheme
On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> Hi all,
>
> I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
>
No, it is not.
Oleg
> Regards
>
> shiva
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
RE: Help regarding the detecting NTLM proxy scheme
Posted by Sadashiv Patwary <SP...@axeda.com>.
Oleg,
Below is the piece of code.to get the scheme . I have a question Does scheme name is always returned irrespective whetherauthentication was success or faild.Is there there any other way to get scheme name . All I want is to display message page to the user if the scheme used is ntlm.
Regards
shiva
HttpClient httpClient = new HttpClient();
if (logger.isDebugEnabled())
{
logger.debug("httpClient : " + httpClient);
}
method = new GetMethod(host);
method.setDoAuthentication(true);
executeMethod = httpClient.executeMethod(method);
AuthState authstate = method.getProxyAuthState();
boolean isNTLM = false;
try
{
Map proxyChallenges = AuthChallengeParser.parseChallenges(
method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty())
{
logger.debug("Proxy authentication challenge(s) not found");
isNTLM = false;
return isNTLM;
}
AuthScheme authscheme = null;
/** Authentication processor */
AuthChallengeProcessor authProcessor = null;
authProcessor = new AuthChallengeProcessor(httpClientParams);
authscheme = authProcessor.processChallenge(authstate, proxyChallenges);
logger.info("Scheme name is " + authscheme.getSchemeName());
if (authscheme.getSchemeName().equalsIgnoreCase("ntlm"))
{
logger.info("Proxy is using NTLMScheme");
isNTLM = true;
} else
{
if (logger.isDebugEnabled())
{
logger.debug("other proxy is " + authscheme.getSchemeName());
}
isNTLM = false;
}
}
-----Original Message-----
From: Sadashiv Patwary [mailto:SPatwary@axeda.com]
Sent: Tuesday, April 15, 2008 1:51 PM
To: HttpClient User Discussion
Subject: RE: Help regarding the detecting NTLM proxy scheme
Can you please suggest how can I retrieve the proxy scheme ?? .
-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Tuesday, April 15, 2008 1:45 PM
To: HttpClient User Discussion
Subject: Re: Help regarding the detecting NTLM proxy scheme
On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> Hi all,
>
> I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
>
No, it is not.
Oleg
> Regards
>
> shiva
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
RE: Help regarding the detecting NTLM proxy scheme
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-04-15 at 13:50 -0400, Sadashiv Patwary wrote:
> Can you please suggest how can I retrieve the proxy scheme ?? .
>
By examining the Proxy-Authenticate response headers.
http://hc.apache.org/httpclient-3.x/xref/org/apache/commons/httpclient/HttpMethodDirector.html#746
Oleg
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, April 15, 2008 1:45 PM
> To: HttpClient User Discussion
> Subject: Re: Help regarding the detecting NTLM proxy scheme
>
>
> On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> > Hi all,
> >
> > I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
> >
>
> No, it is not.
>
> Oleg
>
>
> > Regards
> >
> > shiva
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
RE: Help regarding the detecting NTLM proxy scheme
Posted by Sadashiv Patwary <SP...@axeda.com>.
Can you please suggest how can I retrieve the proxy scheme ?? .
-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Tuesday, April 15, 2008 1:45 PM
To: HttpClient User Discussion
Subject: Re: Help regarding the detecting NTLM proxy scheme
On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> Hi all,
>
> I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
>
No, it is not.
Oleg
> Regards
>
> shiva
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Help regarding the detecting NTLM proxy scheme
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-04-15 at 11:19 -0400, Sadashiv Patwary wrote:
> Hi all,
>
> I am still naïve to httpclient. I want to display a proxy scheme names (NTLM or digest or basic) on the jsp page. Is it possible do that before I run the httpclient execute method.
>
No, it is not.
Oleg
> Regards
>
> shiva
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org