The following comment has been added to this issue:
Author: Kristopher Brown
Created: Wed, 7 Apr 2004 5:23 AM
Body:
Ok, well I can confirm that we still have an issue under RC2 using java pre 1.4.2.
Looks like the code is not responding to the 407 using the authenticator mechanism.
Upgrading to 1.4.2 fixed this issue, but we need to build under 1.3.1 at the moment.
I presume few people have an issue with this as most are running on the latest and
greatest java version, and fewer still are also running behind a proxy that requires
user authentication.
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1152&page=comments#action_18310
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1152
Here is an overview of the issue:
---------------------------------------------------------------------
Key: MAVEN-1152
Summary: Unable to authenticate against proxy server
Type: Bug
Status: Unassigned
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: maven
Components:
core
Fix Fors:
1.1
Versions:
1.0-rc1
Assignee:
Reporter: Kristopher Brown
Created: Fri, 6 Feb 2004 4:54 AM
Updated: Wed, 7 Apr 2004 5:23 AM
Environment: WinXP dev machine, MS ISA Server (Proxy Server) requiring domain
authentication.
Tested under java 1.3.1_07 and 1.4.1_02
Description:
Supplying the proxy host, port, username and password in the build.properties file as
specified in the documentation still failed to get through the proxy server where I
work.
HttpUtils sets the default Authenticator as I'd expect to handle such authentication
challenges, however, I added a line of logging to the getPasswordAuthentication()
method and noticed that is was not being called under our environment. Why this is
the case, I cannot honestly say - however, I have noticed that a few articles on the
web mention how people could not get Authenticator to work.
Reading further, a few sites recommended that the "Proxy-Authentication" header is
used, and I noticed that the "Authentication" header is already being used in
HttpUtils (presumably for pre java 1.2 support). Adding similar handling for
"Proxy-Authentication" header allowed maven to successfully connect through our proxy
server.
I've provided a patch below for this, should it be decided its a reasonable addition.
---------------- PATCH START ----------------
Index: HttpUtils.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28
diff -c -r1.28 HttpUtils.java
*** HttpUtils.java 27 Oct 2003 16:33:11 -0000 1.28
--- HttpUtils.java 6 Feb 2004 09:48:46 -0000
***************
*** 284,289 ****
--- 284,312 ----
throw new Exception( "Not authorized." );
}
}
+ // add proxy authentication header if required
+ if ( proxyUserName != null || proxyPassword != null )
+ {
+ String up = proxyUserName + ":"
+ + (proxyPassword == null ? "" : proxyPassword);
+ String encoding = null;
+ // check to see if sun's Base64 encoder is available.
+ try
+ {
+ sun.misc.BASE64Encoder encoder =
+ (sun.misc.BASE64Encoder) Class.forName(
+ "sun.misc.BASE64Encoder" ).newInstance();
+
+ encoding = encoder.encode( up.getBytes() );
+ }
+ catch ( Exception ex )
+ {
+ // Do nothing, as for MavenSession we will never use
+ // auth and we will eventually move over httpclient
+ // in the commons.
+ }
+ connection.setRequestProperty( "Proxy-Authorization", "Basic " +
encoding );
+ }
// REVISIT: at this point even non HTTP connections may support the
// if-modified-since behaviour - we just check the date of the
----------------- PATCH END -----------------
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]