If you want to use the 2.0 code, you'll need to subclass HttpState and override getProxyCredentials() to prompt for the Credentials object. Then, when you create your HttpClient object, you'll need to set it's HttpState to this new subclass.
David -----Original Message----- From: Russell, Brian [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 18, 2004 4:29 AM To: [EMAIL PROTECTED] Subject: Supplying Credentials only when needed. I am using http client 2.0 I have managed to use the NTCredentials to successfully authenticate with an NTLM proxy, by providing the credentials to the HttpState Credentials proxyCred = new NTCredentials(loggedInUserName,userPassword,"",domainName); client.getState().setProxyCredentials(null,proxyCred); This is all very well where I know for sure that there is an NTLM proxy in place, and I can prompt the user for their Windows logon details, and provide an instance of a Credentials object which is an NTCredentials. My application, however, needs to cater for various environments, where there may be no proxies, proxies authenticating by IP address, proxies using Basic authentication etc etc. Is it possible for httpclient to inform its caller when it encounters a challenge, and to indicate what type of challenge it is. The caller can then decide which type of Credentials object to supply to the state? I don't know if what I am asking for exists, or if it is a new feature. Hopefully the former. Any comments would be appreciated. Thanks, Brian. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]