You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/08/10 04:08:10 UTC

svn commit: r430209 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java

Author: dims
Date: Wed Aug  9 19:08:09 2006
New Revision: 430209

URL: http://svn.apache.org/viewvc?rev=430209&view=rev
Log:
set a credential provider and set the ANY_SCHEME flag. (trying to get NTLM/BASIC working with HTTPS)

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=430209&r1=430208&r2=430209&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Wed Aug  9 19:08:09 2006
@@ -40,6 +40,9 @@
 import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
 import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.auth.CredentialsProvider;
+import org.apache.commons.httpclient.auth.AuthScheme;
+import org.apache.commons.httpclient.auth.CredentialsNotAvailableException;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -353,13 +356,24 @@
             agent.getState().setCredentials(new AuthScope(
                     ntlmAuthentication.getHost(),
                     ntlmAuthentication.getPort(),
-                    null), defaultCredentials);
+                    AuthScope.ANY_REALM,
+                    AuthScope.ANY_SCHEME), defaultCredentials);
+            setCredentialsProvider(agent, defaultCredentials);
             return true;
         }
         return false;
 
     }
 
+    private void setCredentialsProvider(HttpClient agent, final Credentials credentials) {
+        agent.getParams().setParameter(CredentialsProvider.PROVIDER, new CredentialsProvider() {
+            public Credentials getCredentials(AuthScheme authScheme, String string, int i, boolean b)
+                    throws CredentialsNotAvailableException {
+                return credentials;
+            }
+        });
+    }
+
     private void configServerPreemtiveAuthenticaiton(HttpClient agent,
                                                      MessageContext msgCtx,
                                                      HostConfiguration config,
@@ -385,7 +399,6 @@
                     basicAuthentication.getPassword());
             if (basicAuthentication.getPort() == -1 ||
                     basicAuthentication.getHost() == null) {
-
                 agent.getState()
                         .setCredentials(AuthScope.ANY, defaultCredentials);
             } else {
@@ -393,16 +406,19 @@
                     agent.getState().setCredentials(new AuthScope(
                             basicAuthentication.getHost(),
                             basicAuthentication.getPort(),
-                            AuthScope.ANY_REALM), defaultCredentials);
+                            AuthScope.ANY_REALM,
+                            AuthScope.ANY_SCHEME), defaultCredentials);
 
                 } else {
                     agent.getState().setCredentials(new AuthScope(
                             basicAuthentication.getHost(),
                             basicAuthentication.getPort(),
-                            basicAuthentication.getRealm()),
+                            basicAuthentication.getRealm(),
+                            AuthScope.ANY_SCHEME),
                             defaultCredentials);
                 }
             }
+            setCredentialsProvider(agent, defaultCredentials);
         }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org