You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/03/16 19:59:52 UTC
[jira] Commented: (MAVEN-1152) Unable to authenticate against proxy server
The following comment has been added to this issue:
Author: david hulme
Created: Tue, 16 Mar 2004 1:59 PM
Body:
I too am completely unable to use Maven behind a firewall, and I've scoured every tutorial and article, and have tried every method known to God to set proxyHost, proxyPort, proxyUserName, etc, etc, by updating (a) project.properties, (b) setting environment variables, (c) defining variables on command line, d( hard-coding in build.xml and/or build-bootstrap.xms (when I tried to build maven).
Always get: java.net.ConnectException: Connection refused: connect
Maven-1.0-RC1
j2sdk 1.4.2_02
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1152&page=comments#action_17632
---------------------------------------------------------------------
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: Tue, 16 Mar 2004 1:59 PM
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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org