You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Per Thomas Jahr (JIRA)" <ax...@ws.apache.org> on 2004/11/30 15:39:28 UTC

[jira] Created: (AXIS-1689) Broken NTLM support in CommonsHTTPSender

Broken NTLM support in CommonsHTTPSender
----------------------------------------

         Key: AXIS-1689
         URL: http://nagoya.apache.org/jira/browse/AXIS-1689
     Project: Axis
        Type: Bug
  Components: Basic Architecture  
    Versions: current (nightly)    
    Reporter: Per Thomas Jahr


The current implementation of CommonsHTTPSender will not work with proxies using NTLM authentication (ISA Server 2004). According to the documentation for HttpClient one needs to use NTCredentials instead of UsernamePasswordCredentials when setting up credentials. 

The following code will fix the problem (starting at line 287 inside the method getHostConfiguration in org.apache.axis.transport.http.CommonsHTTPSender):

if (tcp.getProxyUser().length() != 0) {

  // begin fix for NTLM
  Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
  tcp.getProxyPassword());
  // if the username is in the form "user\domain" use NTCredentials instead.
  if (tcp.getProxyUser().indexOf("\\") > 0) {
     int domainIndex = tcp.getProxyUser().indexOf("\\");
     String domain = tcp.getProxyUser().substring(0, domainIndex);
     if (tcp.getProxyUser().length() > domainIndex + 1) {
        String user = tcp.getProxyUser().substring(domainIndex + 1);
        proxyCred = new NTCredentials(user, tcp.getProxyPassword(), tcp.getProxyHost(), domain);
     }
   }
   // end fix for NTLM

   client.getState().setProxyCredentials(null, null, proxyCred);
}             


There should certainly be another way of deciding if one should use NTCredentials or UsernamePasswordCredentials than parsing the username for a "\". But this works for me.

If anyone is interested in testing Axis against ISA Server 2004 I can do that from now and until February 2005.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-1689) Broken NTLM support in CommonsHTTPSender

Posted by "Per Thomas Jahr (JIRA)" <ax...@ws.apache.org>.
     [ http://nagoya.apache.org/jira/browse/AXIS-1689?page=comments#action_56102 ]
     
Per Thomas Jahr commented on AXIS-1689:
---------------------------------------

Seems fine to me and it runs correctly. Thanks!

--
Per Thomas


> Broken NTLM support in CommonsHTTPSender
> ----------------------------------------
>
>          Key: AXIS-1689
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1689
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: current (nightly)
>     Reporter: Per Thomas Jahr

>
> The current implementation of CommonsHTTPSender will not work with proxies using NTLM authentication (ISA Server 2004). According to the documentation for HttpClient one needs to use NTCredentials instead of UsernamePasswordCredentials when setting up credentials. 
> The following code will fix the problem (starting at line 287 inside the method getHostConfiguration in org.apache.axis.transport.http.CommonsHTTPSender):
> if (tcp.getProxyUser().length() != 0) {
>   // begin fix for NTLM
>   Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
>   tcp.getProxyPassword());
>   // if the username is in the form "user\domain" use NTCredentials instead.
>   if (tcp.getProxyUser().indexOf("\\") > 0) {
>      int domainIndex = tcp.getProxyUser().indexOf("\\");
>      String domain = tcp.getProxyUser().substring(0, domainIndex);
>      if (tcp.getProxyUser().length() > domainIndex + 1) {
>         String user = tcp.getProxyUser().substring(domainIndex + 1);
>         proxyCred = new NTCredentials(user, tcp.getProxyPassword(), tcp.getProxyHost(), domain);
>      }
>    }
>    // end fix for NTLM
>    client.getState().setProxyCredentials(null, null, proxyCred);
> }             
> There should certainly be another way of deciding if one should use NTCredentials or UsernamePasswordCredentials than parsing the username for a "\". But this works for me.
> If anyone is interested in testing Axis against ISA Server 2004 I can do that from now and until February 2005.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-1689) Broken NTLM support in CommonsHTTPSender

Posted by "Per Thomas Jahr (JIRA)" <ax...@ws.apache.org>.
     [ http://nagoya.apache.org/jira/browse/AXIS-1689?page=comments#action_56103 ]
     
Per Thomas Jahr commented on AXIS-1689:
---------------------------------------

Seems fine to me and it runs correctly. Thanks!

--
Per Thomas


> Broken NTLM support in CommonsHTTPSender
> ----------------------------------------
>
>          Key: AXIS-1689
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1689
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: current (nightly)
>     Reporter: Per Thomas Jahr

>
> The current implementation of CommonsHTTPSender will not work with proxies using NTLM authentication (ISA Server 2004). According to the documentation for HttpClient one needs to use NTCredentials instead of UsernamePasswordCredentials when setting up credentials. 
> The following code will fix the problem (starting at line 287 inside the method getHostConfiguration in org.apache.axis.transport.http.CommonsHTTPSender):
> if (tcp.getProxyUser().length() != 0) {
>   // begin fix for NTLM
>   Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
>   tcp.getProxyPassword());
>   // if the username is in the form "user\domain" use NTCredentials instead.
>   if (tcp.getProxyUser().indexOf("\\") > 0) {
>      int domainIndex = tcp.getProxyUser().indexOf("\\");
>      String domain = tcp.getProxyUser().substring(0, domainIndex);
>      if (tcp.getProxyUser().length() > domainIndex + 1) {
>         String user = tcp.getProxyUser().substring(domainIndex + 1);
>         proxyCred = new NTCredentials(user, tcp.getProxyPassword(), tcp.getProxyHost(), domain);
>      }
>    }
>    // end fix for NTLM
>    client.getState().setProxyCredentials(null, null, proxyCred);
> }             
> There should certainly be another way of deciding if one should use NTCredentials or UsernamePasswordCredentials than parsing the username for a "\". But this works for me.
> If anyone is interested in testing Axis against ISA Server 2004 I can do that from now and until February 2005.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS-1689) Broken NTLM support in CommonsHTTPSender

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://nagoya.apache.org/jira/browse/AXIS-1689?page=history ]
     
Davanum Srinivas resolved AXIS-1689:
------------------------------------

    Resolution: Fixed

Checked in a slightly modified patch. Please cross check latest cvs.

thanks,
dims

> Broken NTLM support in CommonsHTTPSender
> ----------------------------------------
>
>          Key: AXIS-1689
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1689
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: current (nightly)
>     Reporter: Per Thomas Jahr

>
> The current implementation of CommonsHTTPSender will not work with proxies using NTLM authentication (ISA Server 2004). According to the documentation for HttpClient one needs to use NTCredentials instead of UsernamePasswordCredentials when setting up credentials. 
> The following code will fix the problem (starting at line 287 inside the method getHostConfiguration in org.apache.axis.transport.http.CommonsHTTPSender):
> if (tcp.getProxyUser().length() != 0) {
>   // begin fix for NTLM
>   Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
>   tcp.getProxyPassword());
>   // if the username is in the form "user\domain" use NTCredentials instead.
>   if (tcp.getProxyUser().indexOf("\\") > 0) {
>      int domainIndex = tcp.getProxyUser().indexOf("\\");
>      String domain = tcp.getProxyUser().substring(0, domainIndex);
>      if (tcp.getProxyUser().length() > domainIndex + 1) {
>         String user = tcp.getProxyUser().substring(domainIndex + 1);
>         proxyCred = new NTCredentials(user, tcp.getProxyPassword(), tcp.getProxyHost(), domain);
>      }
>    }
>    // end fix for NTLM
>    client.getState().setProxyCredentials(null, null, proxyCred);
> }             
> There should certainly be another way of deciding if one should use NTCredentials or UsernamePasswordCredentials than parsing the username for a "\". But this works for me.
> If anyone is interested in testing Axis against ISA Server 2004 I can do that from now and until February 2005.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira