manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1848005 - in /manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch: ElasticSearchConnection.java ElasticSearchDelete.java ElasticSearchIndex.java
Date Sun, 02 Dec 2018 16:14:42 GMT
Author: kwright
Date: Sun Dec  2 16:14:42 2018
New Revision: 1848005

URL: http://svn.apache.org/viewvc?rev=1848005&view=rev
Log:
Remove basic auth code that's not standard

Modified:
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java?rev=1848005&r1=1848004&r2=1848005&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
(original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnection.java
Sun Dec  2 16:14:42 2018
@@ -78,8 +78,6 @@ public class ElasticSearchConnection
   private final HttpClient client;
   private final String serverLocation;
   private final String indexName;
-  private final String userName;
-  private final String userPassword;
   
   private String resultDescription = "";
   private String callUrlSnippet = null;
@@ -95,38 +93,19 @@ public class ElasticSearchConnection
     this.client = client;
     serverLocation = config.getServerLocation();
     indexName = config.getIndexName();
-    userName = config.getUserName();
-    userPassword = config.getPassword();
   }
 
   protected StringBuffer getApiUrl(String command, boolean checkConnection) throws ManifoldCFException
   {
-    String basicAuth = "";
-    if (userName.length() > 0 && userPassword.length() >0) {
-      basicAuth = userName + ":" + userPassword + "@";
-    }
-    Logging.connectors.debug("Auth: " + basicAuth);
-
-    String[] serverLocationSplit = serverLocation.split("://",2);
-    StringBuffer url;
-    if (basicAuth.length() > 0) {
-      url = new StringBuffer(serverLocationSplit[0] + "://" + basicAuth + serverLocationSplit[1]);
-    }
-    else {
-      url = new StringBuffer(serverLocationSplit[0] + "://" + basicAuth + serverLocationSplit[1]);
-    }
+    StringBuffer url = new StringBuffer(serverLocation);
     if (!serverLocation.endsWith("/"))
       url.append('/');
 
-    Logging.connectors.debug("Url: " + url);
-
     if(!checkConnection)
       url.append(URLEncoder.encode(indexName)).append("/");
     url.append(command);
     callUrlSnippet = url.toString();
 
-    Logging.connectors.debug("UrlEnc: " + url);
-
     return url;
   }
 

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java?rev=1848005&r1=1848004&r2=1848005&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java
(original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchDelete.java
Sun Dec  2 16:14:42 2018
@@ -47,15 +47,6 @@ public class ElasticSearchDelete extends
           "/" + config.getIndexName() + "/" + config.getIndexType()
           + "/" + idField);
 
-      if (config.getUserName().length() > 0 && config.getPassword().length() >0)
{
-        byte[] basicAuth = (config.getUserName() + ":" + config.getPassword()).getBytes();
-        Base64 encoder = new Base64();
-        String encoding = encoder.encodeByteArray(basicAuth);
-        method.setHeader("Authorization", "Basic " + encoding);
-        Header header = method.getLastHeader("Authorization");
-        Logging.connectors.debug("Header: " + new String(header.getValue().getBytes()));
-      }
-
       call(method);
       String error = checkJson(jsonException);
       if (getResult() == Result.OK && error == null)

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java?rev=1848005&r1=1848004&r2=1848005&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
(original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Sun Dec  2 16:14:42 2018
@@ -434,15 +434,6 @@ public class ElasticSearchIndex extends
       config.getIndexingDateAttributeName(),
       config.getMimeTypeAttributeName()));
     
-      if (config.getUserName().length() > 0 && config.getPassword().length() >0)
{
-        byte[] basicAuth = (config.getUserName() + ":" + config.getPassword()).getBytes();
-        Base64 encoder = new Base64();
-        String encoding = encoder.encodeByteArray(basicAuth);
-        put.setHeader("Authorization", "Basic " + encoding);
-        Header header = put.getLastHeader("Authorization");
-        Logging.connectors.debug("Header: " + new String(header.getValue().getBytes()));
-      }
-
     if (call(put) == false)
       return false;
     String error = checkJson(jsonException);



Mime
View raw message