When running on windows use current credentials for SPUserProfile Adaptor
Code Review : https://codereview.appspot.com/62330043/
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
index 37ab8a8..913da42 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
@@ -166,8 +166,10 @@
   @Override
   public void initConfig(Config config) {
     config.addKey("sharepoint.server", null);
-    config.addKey("sharepoint.username", null);
-    config.addKey("sharepoint.password", null);
+    boolean onWindows = System.getProperty("os.name").contains("Windows");
+    // When running on Windows, Windows Authentication can log us in.
+    config.addKey("sharepoint.username", onWindows ? "" : null);
+    config.addKey("sharepoint.password", onWindows ? "" : null);
     config.addKey("profile.setacl", "true");
     config.addKey("adaptor.namespace", "Default");
     config.addKey("profile.mysitehost", "");
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
index 5886ad3..f08919b 100644
--- a/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
+++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
@@ -94,6 +94,22 @@
   }
 
   @Test
+  public void testBlankCredentialsOnWindows() throws IOException {
+    Assume.assumeTrue(System.getProperty("os.name").contains("Windows"));
+    Config adaptorConfig = new Config();
+    new SharePointUserProfileAdaptor().initConfig(adaptorConfig);
+    adaptorConfig.overrideKey(
+        "sharepoint.server", "http://sharepoint.example.com");
+    assertEquals(adaptorConfig.getValue("sharepoint.username"), "");
+    assertEquals(adaptorConfig.getValue("sharepoint.password"), "");
+    MockUserProfileServiceFactoryImpl serviceFactory =
+        new MockUserProfileServiceFactoryImpl(null);
+    adaptor = new SharePointUserProfileAdaptor(serviceFactory);
+    AccumulatingDocIdPusher pusher = new AccumulatingDocIdPusher();
+    adaptor.init(new MockAdaptorContext(adaptorConfig, pusher));
+  }
+
+  @Test
   public void testGetDocIds() throws IOException, InterruptedException {
     MockUserProfileServiceFactoryImpl serviceFactory =
         new MockUserProfileServiceFactoryImpl(null);