You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/16 22:22:18 UTC

svn commit: r1779118 - in /axis/axis2/java/core/trunk/modules/transport: http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/ http/src/org/apache/axis2/transport/http/impl/httpclient4/

Author: veithen
Date: Mon Jan 16 22:22:18 2017
New Revision: 1779118

URL: http://svn.apache.org/viewvc?rev=1779118&view=rev
Log:
Move the setAuthenticationInfo method to RequestImpl.

Modified:
    axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
    axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java

Modified: axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1779118&r1=1779117&r2=1779118&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java Mon Jan 16 22:22:18 2017
@@ -22,9 +22,7 @@ package org.apache.axis2.transport.http.
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPInputStream;
 
@@ -35,7 +33,6 @@ import org.apache.axis2.context.MessageC
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.http.AxisRequestEntity;
-import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPSender;
 import org.apache.axis2.transport.http.Request;
@@ -44,17 +41,10 @@ import org.apache.commons.httpclient.Hea
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.HeaderElement;
-import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.HttpState;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.NTCredentials;
 import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthPolicy;
-import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
@@ -74,6 +64,11 @@ public class HTTPSenderImpl extends HTTP
         return httpVersion;
     }
 
+    // TODO: this shouldn't be here (see AXIS2-4021)
+    void setAllowedRetry(boolean isAllowedRetry) {
+        this.isAllowedRetry = isAllowedRetry;
+    }
+
     /**
      * Used to send a request via HTTP Get method
      * 
@@ -281,91 +276,6 @@ public class HTTPSenderImpl extends HTTP
         return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null);
     }
 
-    /*
-     * This will handle server Authentication, It could be either NTLM, Digest
-     * or Basic Authentication. Apart from that user can change the priory or
-     * add a custom authentication scheme.
-     */
-    protected void setAuthenticationInfo(HttpClient agent, MessageContext msgCtx,
-            HostConfiguration config) throws AxisFault {
-        HTTPAuthenticator authenticator;
-        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
-        if (obj != null) {
-            if (obj instanceof HTTPAuthenticator) {
-                authenticator = (HTTPAuthenticator) obj;
-
-                String username = authenticator.getUsername();
-                String password = authenticator.getPassword();
-                String host = authenticator.getHost();
-                String domain = authenticator.getDomain();
-
-                int port = authenticator.getPort();
-                String realm = authenticator.getRealm();
-
-                /* If retrying is available set it first */
-                isAllowedRetry = authenticator.isAllowedRetry();
-
-                Credentials creds;
-
-                HttpState tmpHttpState = null;
-                HttpState httpState = (HttpState) msgCtx
-                        .getProperty(HTTPConstants.CACHED_HTTP_STATE);
-                if (httpState != null) {
-                    tmpHttpState = httpState;
-                } else {
-                    tmpHttpState = agent.getState();
-                }
-
-                agent.getParams().setAuthenticationPreemptive(
-                        authenticator.getPreemptiveAuthentication());
-
-                if (host != null) {
-                    if (domain != null) {
-                        /* Credentials for NTLM Authentication */
-                        creds = new NTCredentials(username, password, host, domain);
-                    } else {
-                        /* Credentials for Digest and Basic Authentication */
-                        creds = new UsernamePasswordCredentials(username, password);
-                    }
-                    tmpHttpState.setCredentials(new AuthScope(host, port, realm), creds);
-                } else {
-                    if (domain != null) {
-                        /*
-                         * Credentials for NTLM Authentication when host is
-                         * ANY_HOST
-                         */
-                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
-                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
-                                creds);
-                    } else {
-                        /* Credentials only for Digest and Basic Authentication */
-                        creds = new UsernamePasswordCredentials(username, password);
-                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
-                    }
-                }
-                /* Customizing the priority Order */
-                List schemes = authenticator.getAuthSchemes();
-                if (schemes != null && schemes.size() > 0) {
-                    List authPrefs = new ArrayList(3);
-                    for (int i = 0; i < schemes.size(); i++) {
-                        if (schemes.get(i) instanceof AuthPolicy) {
-                            authPrefs.add(schemes.get(i));
-                            continue;
-                        }
-                        String scheme = (String) schemes.get(i);
-                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
-
-                    }
-                    agent.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
-                }
-
-            } else {
-                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
-            }
-        }
-
-    }
-
     /**
      * Method used to copy all the common properties
      * 

Modified: axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java?rev=1779118&r1=1779117&r2=1779118&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java Mon Jan 16 22:22:18 2017
@@ -20,6 +20,8 @@ package org.apache.axis2.transport.http.
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
@@ -27,10 +29,12 @@ import org.apache.axis2.context.NamedVal
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.http.AxisRequestEntity;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.transport.http.Request;
 import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
@@ -38,6 +42,10 @@ import org.apache.commons.httpclient.Htt
 import org.apache.commons.httpclient.HttpState;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.HttpVersion;
+import org.apache.commons.httpclient.NTCredentials;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthPolicy;
+import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
 import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.apache.commons.httpclient.protocol.Protocol;
@@ -241,7 +249,7 @@ final class RequestImpl implements Reque
 
         if (isAuthenticationEnabled) {
             // Basic, Digest, NTLM and custom authentications.
-            sender.setAuthenticationInfo(httpClient, msgContext, config);
+            setAuthenticationInfo();
         }
         // proxy configuration
 
@@ -252,4 +260,88 @@ final class RequestImpl implements Reque
             HTTPProxyConfigurator.configure(msgContext, httpClient, config);
         }
     }
+
+    /*
+     * This will handle server Authentication, It could be either NTLM, Digest
+     * or Basic Authentication. Apart from that user can change the priory or
+     * add a custom authentication scheme.
+     */
+    private void setAuthenticationInfo() throws AxisFault {
+        HTTPAuthenticator authenticator;
+        Object obj = msgContext.getProperty(HTTPConstants.AUTHENTICATE);
+        if (obj != null) {
+            if (obj instanceof HTTPAuthenticator) {
+                authenticator = (HTTPAuthenticator) obj;
+
+                String username = authenticator.getUsername();
+                String password = authenticator.getPassword();
+                String host = authenticator.getHost();
+                String domain = authenticator.getDomain();
+
+                int port = authenticator.getPort();
+                String realm = authenticator.getRealm();
+
+                /* If retrying is available set it first */
+                sender.setAllowedRetry(authenticator.isAllowedRetry());
+
+                Credentials creds;
+
+                HttpState tmpHttpState = null;
+                HttpState httpState = (HttpState) msgContext
+                        .getProperty(HTTPConstants.CACHED_HTTP_STATE);
+                if (httpState != null) {
+                    tmpHttpState = httpState;
+                } else {
+                    tmpHttpState = httpClient.getState();
+                }
+
+                httpClient.getParams().setAuthenticationPreemptive(
+                        authenticator.getPreemptiveAuthentication());
+
+                if (host != null) {
+                    if (domain != null) {
+                        /* Credentials for NTLM Authentication */
+                        creds = new NTCredentials(username, password, host, domain);
+                    } else {
+                        /* Credentials for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                    }
+                    tmpHttpState.setCredentials(new AuthScope(host, port, realm), creds);
+                } else {
+                    if (domain != null) {
+                        /*
+                         * Credentials for NTLM Authentication when host is
+                         * ANY_HOST
+                         */
+                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
+                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
+                                creds);
+                    } else {
+                        /* Credentials only for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                        tmpHttpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
+                    }
+                }
+                /* Customizing the priority Order */
+                List schemes = authenticator.getAuthSchemes();
+                if (schemes != null && schemes.size() > 0) {
+                    List authPrefs = new ArrayList(3);
+                    for (int i = 0; i < schemes.size(); i++) {
+                        if (schemes.get(i) instanceof AuthPolicy) {
+                            authPrefs.add(schemes.get(i));
+                            continue;
+                        }
+                        String scheme = (String) schemes.get(i);
+                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
+
+                    }
+                    httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
+                }
+
+            } else {
+                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
+            }
+        }
+
+    }
 }

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1779118&r1=1779117&r2=1779118&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Mon Jan 16 22:22:18 2017
@@ -26,7 +26,6 @@ import org.apache.axis2.context.MessageC
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.http.AxisRequestEntity;
-import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPSender;
 import org.apache.axis2.transport.http.Request;
@@ -38,11 +37,6 @@ import org.apache.http.HeaderElement;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.NameValuePair;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
-import org.apache.http.auth.NTCredentials;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.auth.params.AuthPNames;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
@@ -55,7 +49,6 @@ import org.apache.http.conn.scheme.Plain
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.auth.NTLMSchemeFactory;
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.impl.conn.PoolingClientConnectionManager;
@@ -69,9 +62,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPInputStream;
 
@@ -87,6 +78,11 @@ public class HTTPSenderImpl extends HTTP
         return httpVersion;
     }
 
+    // TODO: this shouldn't be here (see AXIS2-4021)
+    void setAllowedRetry(boolean isAllowedRetry) {
+        this.isAllowedRetry = isAllowedRetry;
+    }
+
     /**
      * Used to send a request via HTTP Get method
      *
@@ -281,86 +277,6 @@ public class HTTPSenderImpl extends HTTP
         return (msgCtx.getProperty(HTTPConstants.AUTHENTICATE) != null);
     }
 
-    /*
-     * This will handle server Authentication, It could be either NTLM, Digest
-     * or Basic Authentication. Apart from that user can change the priory or
-     * add a custom authentication scheme.
-     */
-    protected void setAuthenticationInfo(AbstractHttpClient agent, MessageContext msgCtx)
-            throws AxisFault {
-        HTTPAuthenticator authenticator;
-        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
-        if (obj != null) {
-            if (obj instanceof HTTPAuthenticator) {
-                authenticator = (HTTPAuthenticator) obj;
-
-                String username = authenticator.getUsername();
-                String password = authenticator.getPassword();
-                String host = authenticator.getHost();
-                String domain = authenticator.getDomain();
-
-                int port = authenticator.getPort();
-                String realm = authenticator.getRealm();
-
-                /* If retrying is available set it first */
-                isAllowedRetry = authenticator.isAllowedRetry();
-
-                Credentials creds;
-
-                // TODO : Set preemptive authentication, but its not recommended in HC 4
-
-                if (host != null) {
-                    if (domain != null) {
-                        /* Credentials for NTLM Authentication */
-                        agent.getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
-                        creds = new NTCredentials(username, password, host, domain);
-                    } else {
-                        /* Credentials for Digest and Basic Authentication */
-                        creds = new UsernamePasswordCredentials(username, password);
-                    }
-                    agent.getCredentialsProvider().
-                            setCredentials(new AuthScope(host, port, realm), creds);
-                } else {
-                    if (domain != null) {
-                        /*
-                         * Credentials for NTLM Authentication when host is
-                         * ANY_HOST
-                         */
-                        agent.getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
-                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
-                        agent.getCredentialsProvider().
-                                setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
-                                               creds);
-                    } else {
-                        /* Credentials only for Digest and Basic Authentication */
-                        creds = new UsernamePasswordCredentials(username, password);
-                        agent.getCredentialsProvider().
-                                setCredentials(new AuthScope(AuthScope.ANY), creds);
-                    }
-                }
-                /* Customizing the priority Order */
-                List schemes = authenticator.getAuthSchemes();
-                if (schemes != null && schemes.size() > 0) {
-                    List authPrefs = new ArrayList(3);
-                    for (int i = 0; i < schemes.size(); i++) {
-                        if (schemes.get(i) instanceof AuthPolicy) {
-                            authPrefs.add(schemes.get(i));
-                            continue;
-                        }
-                        String scheme = (String) schemes.get(i);
-                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
-
-                    }
-                    agent.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authPrefs);
-                }
-
-            } else {
-                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
-            }
-        }
-
-    }
-
     /**
      * Method used to copy all the common properties
      *

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java?rev=1779118&r1=1779117&r2=1779118&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java Mon Jan 16 22:22:18 2017
@@ -20,6 +20,8 @@ package org.apache.axis2.transport.http.
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
@@ -27,6 +29,7 @@ import org.apache.axis2.context.NamedVal
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.http.AxisRequestEntity;
+import org.apache.axis2.transport.http.HTTPAuthenticator;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPTransportConstants;
 import org.apache.axis2.transport.http.Request;
@@ -40,8 +43,15 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.Credentials;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.auth.params.AuthPNames;
 import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.params.AuthPolicy;
 import org.apache.http.client.params.ClientPNames;
+import org.apache.http.impl.auth.NTLMSchemeFactory;
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
@@ -239,7 +249,7 @@ final class RequestImpl implements Reque
 
         if (isAuthenticationEnabled) {
             // Basic, Digest, NTLM and custom authentications.
-            sender.setAuthenticationInfo(httpClient, msgContext);
+            setAuthenticationInfo();
         }
         // proxy configuration
 
@@ -250,4 +260,83 @@ final class RequestImpl implements Reque
             HTTPProxyConfigurator.configure(msgContext, httpClient);
         }
     }
+
+    /*
+     * This will handle server Authentication, It could be either NTLM, Digest
+     * or Basic Authentication. Apart from that user can change the priory or
+     * add a custom authentication scheme.
+     */
+    private void setAuthenticationInfo() throws AxisFault {
+        HTTPAuthenticator authenticator;
+        Object obj = msgContext.getProperty(HTTPConstants.AUTHENTICATE);
+        if (obj != null) {
+            if (obj instanceof HTTPAuthenticator) {
+                authenticator = (HTTPAuthenticator) obj;
+
+                String username = authenticator.getUsername();
+                String password = authenticator.getPassword();
+                String host = authenticator.getHost();
+                String domain = authenticator.getDomain();
+
+                int port = authenticator.getPort();
+                String realm = authenticator.getRealm();
+
+                /* If retrying is available set it first */
+                sender.setAllowedRetry(authenticator.isAllowedRetry());
+
+                Credentials creds;
+
+                // TODO : Set preemptive authentication, but its not recommended in HC 4
+
+                if (host != null) {
+                    if (domain != null) {
+                        /* Credentials for NTLM Authentication */
+                        httpClient.getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
+                        creds = new NTCredentials(username, password, host, domain);
+                    } else {
+                        /* Credentials for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                    }
+                    httpClient.getCredentialsProvider().
+                            setCredentials(new AuthScope(host, port, realm), creds);
+                } else {
+                    if (domain != null) {
+                        /*
+                         * Credentials for NTLM Authentication when host is
+                         * ANY_HOST
+                         */
+                        httpClient.getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
+                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
+                        httpClient.getCredentialsProvider().
+                                setCredentials(new AuthScope(AuthScope.ANY_HOST, port, realm),
+                                               creds);
+                    } else {
+                        /* Credentials only for Digest and Basic Authentication */
+                        creds = new UsernamePasswordCredentials(username, password);
+                        httpClient.getCredentialsProvider().
+                                setCredentials(new AuthScope(AuthScope.ANY), creds);
+                    }
+                }
+                /* Customizing the priority Order */
+                List schemes = authenticator.getAuthSchemes();
+                if (schemes != null && schemes.size() > 0) {
+                    List authPrefs = new ArrayList(3);
+                    for (int i = 0; i < schemes.size(); i++) {
+                        if (schemes.get(i) instanceof AuthPolicy) {
+                            authPrefs.add(schemes.get(i));
+                            continue;
+                        }
+                        String scheme = (String) schemes.get(i);
+                        authPrefs.add(authenticator.getAuthPolicyPref(scheme));
+
+                    }
+                    httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authPrefs);
+                }
+
+            } else {
+                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
+            }
+        }
+
+    }
 }