jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 1
  • MAVEN-1152

Unable to authenticate against proxy server

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-rc1
  • Fix Version/s: 1.0-rc4
  • Component/s: core
  • Labels:
    None
  • 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 )
        +
        Unknown macro: {+ String up = proxyUserName + "}

// REVISIT: at this point even non HTTP connections may support the
// if-modified-since behaviour - we just check the date of the
----------------- PATCH END -----------------

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Emmanuel Venisse added a comment - 06/Feb/04 5:10 AM

I'm not sure it's work for other proxy, so, I'll wait some tests from other users before apply it.

Show
Emmanuel Venisse added a comment - 06/Feb/04 5:10 AM I'm not sure it's work for other proxy, so, I'll wait some tests from other users before apply it.
Hide
Permalink
Kristopher Brown added a comment - 06/Feb/04 5:37 AM

Patch was incorrect.

---------------- 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 10:31:07 -0000
        ***************
      • 255,260 ****
      • 255,283 ----
        }
        connection.setRequestProperty( "Authorization", "Basic " + encoding );
        }
        + // add proxy authentication header if required
        + if ( proxyUserName != null || proxyPassword != null )
        +
        Unknown macro: {+ String up = proxyUserName + "}

//connect to the remote site (may take some time)
connection.connect();
----------------- PATCH END -----------------

Show
Kristopher Brown added a comment - 06/Feb/04 5:37 AM Patch was incorrect. ---------------- 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 10:31:07 -0000 ***************
      • 255,260 ****
      • 255,283 ---- } connection.setRequestProperty( "Authorization", "Basic " + encoding ); } + // add proxy authentication header if required + if ( proxyUserName != null || proxyPassword != null ) +
        Unknown macro: {+ String up = proxyUserName + "}
//connect to the remote site (may take some time) connection.connect(); ----------------- PATCH END -----------------
Hide
Permalink
david hulme added a comment - 16/Mar/04 1:59 PM

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

Show
david hulme added a comment - 16/Mar/04 1:59 PM 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
Hide
Permalink
Kristopher Brown added a comment - 02/Apr/04 5:39 AM

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.

Show
Kristopher Brown added a comment - 02/Apr/04 5:39 AM 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.
Hide
Permalink
Kristopher Brown added a comment - 07/Apr/04 5:23 AM

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.

Show
Kristopher Brown added a comment - 07/Apr/04 5:23 AM 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.
Hide
Permalink
Brett Porter added a comment - 08/Jul/04 9:17 AM

I have a feeling this was fixed with the changes in RC4 - ask for it to be reopened if still broken in the same way

Show
Brett Porter added a comment - 08/Jul/04 9:17 AM I have a feeling this was fixed with the changes in RC4 - ask for it to be reopened if still broken in the same way

People

  • Assignee:
    Unassigned
    Reporter:
    Kristopher Brown
Vote (0)
Watch (0)

Dates

  • Created:
    06/Feb/04 4:54 AM
    Updated:
    08/Mar/06 10:47 PM
    Resolved:
    08/Jul/04 9:17 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.