Fix for b/12589674 Running adaptor from windows machine expects to have SharePoint username and password specified.
Code review : https://codereview.appspot.com/55750043/
diff --git a/src/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandler.java b/src/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandler.java
index f01c759..035dafc 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandler.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandler.java
@@ -15,6 +15,7 @@
package com.google.enterprise.adaptor.sharepoint;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationMode;
import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationSoap;
import com.microsoft.schemas.sharepoint.soap.authentication.LoginErrorCode;
@@ -68,7 +69,7 @@
this.password = password;
this.executor = executor;
this.authenticationClient = authenticationClient;
- }
+ }
public List<String> getAuthenticationCookies() {
return Collections.unmodifiableList(authenticationCookiesList);
@@ -84,6 +85,13 @@
return;
}
+ if ("".equals(userName) || "".equals(password)) {
+ log.log(Level.FINE,
+ "Empty username / password. Using authentication mode as Windows");
+ authenticationMode = AuthenticationMode.WINDOWS;
+ return;
+ }
+
LoginResult result;
try {
result = authenticationClient.login(userName, password);