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/04/02 12:39:44 UTC
[jira] Commented: (MAVEN-1152) Unable to authenticate against proxy server
The following comment has been added to this issue:
Author: Kristopher Brown
Created: Fri, 2 Apr 2004 5:39 AM
Body:
No longer an issue under RC2, not sure what has changed elswhere in the code base for this to work again.
I guess this should just be closed now.
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1152&page=comments#action_18092
---------------------------------------------------------------------
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: Fri, 2 Apr 2004 5:39 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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org