Author: kwright
Date: Tue Mar 31 13:57:25 2015
New Revision: 1670343

URL: http://svn.apache.org/r1670343
Log:
Use post data to communicate login credentials, for security

Modified:
    
manifoldcf/branches/CONNECTORS-1177/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
    
manifoldcf/branches/CONNECTORS-1177/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
    
manifoldcf/branches/CONNECTORS-1177/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java

Modified: 
manifoldcf/branches/CONNECTORS-1177/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1177/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java?rev=1670343&r1=1670342&r2=1670343&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1177/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1177/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
 Tue Mar 31 13:57:25 2015
@@ -63,7 +63,9 @@ public class APISanityTester
     ConfigurationNode child;
     Configuration requestObject;
     Configuration result;
-      
+
+    instance.loginAPI("","");
+    
     connectionObject = new ConfigurationNode("repositoryconnection");
     
     child = new ConfigurationNode("name");

Modified: 
manifoldcf/branches/CONNECTORS-1177/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1177/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java?rev=1670343&r1=1670342&r2=1670343&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1177/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1177/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
 Tue Mar 31 13:57:25 2015
@@ -493,6 +493,22 @@ public class APIServlet extends HttpServ
       }
       else
       {
+        String loutputText = "{}";
+        byte[] lresponseValue = loutputText.getBytes(StandardCharsets.UTF_8);
+
+        // Set response mime type
+        response.setContentType("text/plain; charset=utf-8");
+        response.setIntHeader("Content-Length", (int)lresponseValue.length);
+        ServletOutputStream out = response.getOutputStream();
+        try
+        {
+          out.write(lresponseValue,0,lresponseValue.length);
+          out.flush();
+        }
+        finally
+        {
+          out.close();
+        }
         return;
       }
     }

Modified: 
manifoldcf/branches/CONNECTORS-1177/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1177/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java?rev=1670343&r1=1670342&r2=1670343&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1177/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1177/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
 Tue Mar 31 13:57:25 2015
@@ -197,6 +197,19 @@ public class ManifoldCFInstance
   
   // These methods allow communication with the ManifoldCF api webapp, via the 
locally-instantiated jetty
   
+  public void loginAPI(String userID, String password)
+    throws Exception
+  {
+    Configuration requestObject = new Configuration();
+    ConfigurationNode cn = new ConfigurationNode("userID");
+    cn.setValue(userID);
+    requestObject.addChild(requestObject.getChildCount(),cn);
+    cn = new ConfigurationNode("password");
+    cn.setValue(password);
+    requestObject.addChild(requestObject.getChildCount(),cn);
+    performAPIPostOperationViaNodes("LOGIN",200,requestObject);
+  }
+  
   public void startJobAPI(String jobIDString)
     throws Exception
   {


Reply via email to