manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1503138 - in /manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf: authorities/authorities/jdbc/JDBCAuthority.java crawler/connectors/jdbc/JDBCConnector.java
Date Mon, 15 Jul 2013 08:41:19 GMT
Author: kwright
Date: Mon Jul 15 08:41:19 2013
New Revision: 1503138

URL: http://svn.apache.org/r1503138
Log:
Add password protection to jdbc connector.

Modified:
    manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
    manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java

Modified: manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java?rev=1503138&r1=1503137&r2=1503138&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
(original)
+++ manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
Mon Jul 15 08:41:19 2013
@@ -346,31 +346,33 @@ public class JDBCAuthority extends BaseA
   public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out,
     Locale locale, ConfigParams parameters, String tabName)
     throws ManifoldCFException, IOException {
-    String lJdbcProvider = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.providerParameter);
+    String lJdbcProvider = parameters.getParameter(JDBCConstants.providerParameter);
     if (lJdbcProvider == null) {
       lJdbcProvider = "oracle:thin:@";
     }
-    String lHost = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.hostParameter);
+    String lHost = parameters.getParameter(JDBCConstants.hostParameter);
     if (lHost == null) {
       lHost = "localhost";
     }
-    String lDatabaseName = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseNameParameter);
+    String lDatabaseName = parameters.getParameter(JDBCConstants.databaseNameParameter);
     if (lDatabaseName == null) {
       lDatabaseName = "database";
     }
-    String databaseUser = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserName);
+    String databaseUser = parameters.getParameter(JDBCConstants.databaseUserName);
     if (databaseUser == null) {
       databaseUser = "";
     }
-    String databasePassword = parameters.getObfuscatedParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databasePassword);
+    String databasePassword = parameters.getObfuscatedParameter(JDBCConstants.databasePassword);
     if (databasePassword == null) {
       databasePassword = "";
+    } else {
+      databasePassword = out.mapPasswordToKey(password);
     }
-    String lIdQuery = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserIdQuery);
+    String lIdQuery = parameters.getParameter(JDBCConstants.databaseUserIdQuery);
     if (lIdQuery == null) {
       lIdQuery = "SELECT idfield FROM usertable WHERE login = $(USERNAME)";
     }
-    String lTokenQuery = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseTokensQuery);
+    String lTokenQuery = parameters.getParameter(JDBCConstants.databaseTokensQuery);
     if (lTokenQuery == null) {
       lTokenQuery = "SELECT groupnamefield FROM grouptable WHERE user_id = $(UID) or login
= $(USERNAME)";
     }
@@ -476,37 +478,37 @@ public class JDBCAuthority extends BaseA
     throws ManifoldCFException {
     String type = variableContext.getParameter("databasetype");
     if (type != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.providerParameter,
type);
+      parameters.setParameter(JDBCConstants.providerParameter, type);
     }
 
     String lHost = variableContext.getParameter("databasehost");
     if (lHost != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.hostParameter,
lHost);
+      parameters.setParameter(JDBCConstants.hostParameter, lHost);
     }
 
     String lDatabaseName = variableContext.getParameter("databasename");
     if (lDatabaseName != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseNameParameter,
lDatabaseName);
+      parameters.setParameter(JDBCConstants.databaseNameParameter, lDatabaseName);
     }
 
     String lUserName = variableContext.getParameter("username");
     if (lUserName != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserName,
lUserName);
+      parameters.setParameter(JDBCConstants.databaseUserName, lUserName);
     }
 
     String lPassword = variableContext.getParameter("password");
     if (lPassword != null) {
-      parameters.setObfuscatedParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databasePassword,
lPassword);
+      parameters.setObfuscatedParameter(JDBCConstants.databasePassword, variableContext.mapKeyToPassword(lPassword));
     }
 
     String lIdQuery = variableContext.getParameter("idquery");
     if (lIdQuery != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserIdQuery,
lIdQuery);
+      parameters.setParameter(JDBCConstants.databaseUserIdQuery, lIdQuery);
     }
 
     String lTokenQuery = variableContext.getParameter("tokenquery");
     if (lTokenQuery != null) {
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseTokensQuery,
lTokenQuery);
+      parameters.setParameter(JDBCConstants.databaseTokensQuery, lTokenQuery);
     }
 
     return null;

Modified: manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java?rev=1503138&r1=1503137&r2=1503138&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-737/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
Mon Jul 15 08:41:19 2013
@@ -740,24 +740,26 @@ public class JDBCConnector extends org.a
     Locale locale, ConfigParams parameters, String tabName)
     throws ManifoldCFException, IOException
   {
-    String jdbcProvider = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.providerParameter);
+    String jdbcProvider = parameters.getParameter(JDBCConstants.providerParameter);
     if (jdbcProvider == null)
       jdbcProvider = "oracle:thin:@";
-    String accessMethod = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.methodParameter);
+    String accessMethod = parameters.getParameter(JDBCConstants.methodParameter);
     if (accessMethod == null)
       accessMethod = "name";
-    String host = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.hostParameter);
+    String host = parameters.getParameter(JDBCConstants.hostParameter);
     if (host == null)
       host = "localhost";
-    String databaseName = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseNameParameter);
+    String databaseName = parameters.getParameter(JDBCConstants.databaseNameParameter);
     if (databaseName == null)
       databaseName = "database";
-    String databaseUser = parameters.getParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserName);
+    String databaseUser = parameters.getParameter(JDBCConstants.databaseUserName);
     if (databaseUser == null)
       databaseUser = "";
-    String databasePassword = parameters.getObfuscatedParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databasePassword);
+    String databasePassword = parameters.getObfuscatedParameter(JDBCConstants.databasePassword);
     if (databasePassword == null)
       databasePassword = "";
+    else
+      databasePassword = out.mapPasswordToKey(databasePassword);
 
     // "Database Type" tab
     if (tabName.equals(Messages.getString(locale,"JDBCConnector.DatabaseType")))
@@ -859,27 +861,27 @@ public class JDBCConnector extends org.a
   {
     String type = variableContext.getParameter("databasetype");
     if (type != null)
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.providerParameter,type);
+      parameters.setParameter(JDBCConstants.providerParameter,type);
 
     String accessMethod = variableContext.getParameter("accessmethod");
     if (accessMethod != null)
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.methodParameter,accessMethod);
+      parameters.setParameter(JDBCConstants.methodParameter,accessMethod);
 
     String host = variableContext.getParameter("databasehost");
     if (host != null)
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.hostParameter,host);
+      parameters.setParameter(JDBCConstants.hostParameter,host);
 
     String databaseName = variableContext.getParameter("databasename");
     if (databaseName != null)
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseNameParameter,databaseName);
+      parameters.setParameter(JDBCConstants.databaseNameParameter,databaseName);
 
     String userName = variableContext.getParameter("username");
     if (userName != null)
-      parameters.setParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databaseUserName,userName);
+      parameters.setParameter(JDBCConstants.databaseUserName,userName);
 
     String password = variableContext.getParameter("password");
     if (password != null)
-      parameters.setObfuscatedParameter(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.databasePassword,password);
+      parameters.setObfuscatedParameter(JDBCConstants.databasePassword,variableContext.mapKeyToPassword(password));
     
     return null;
   }
@@ -1063,19 +1065,19 @@ public class JDBCConnector extends org.a
     while (i < ds.getChildCount())
     {
       SpecificationNode sn = ds.getChild(i++);
-      if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+      if (sn.getType().equals(JDBCConstants.idQueryNode))
       {
         idQuery = sn.getValue();
         if (idQuery == null)
           idQuery = "";
       }
-      else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+      else if (sn.getType().equals(JDBCConstants.versionQueryNode))
       {
         versionQuery = sn.getValue();
         if (versionQuery == null)
           versionQuery = "";
       }
-      else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+      else if (sn.getType().equals(JDBCConstants.dataQueryNode))
       {
         dataQuery = sn.getValue();
         if (dataQuery == null)
@@ -1223,12 +1225,12 @@ public class JDBCConnector extends org.a
       int i = 0;
       while (i < ds.getChildCount())
       {
-        if (ds.getChild(i).getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+        if (ds.getChild(i).getType().equals(JDBCConstants.idQueryNode))
           ds.removeChild(i);
         else
           i++;
       }
-      sn = new SpecificationNode(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode);
+      sn = new SpecificationNode(JDBCConstants.idQueryNode);
       sn.setValue(idQuery);
       ds.addChild(ds.getChildCount(),sn);
     }
@@ -1237,12 +1239,12 @@ public class JDBCConnector extends org.a
       int i = 0;
       while (i < ds.getChildCount())
       {
-        if (ds.getChild(i).getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+        if (ds.getChild(i).getType().equals(JDBCConstants.versionQueryNode))
           ds.removeChild(i);
         else
           i++;
       }
-      sn = new SpecificationNode(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode);
+      sn = new SpecificationNode(JDBCConstants.versionQueryNode);
       sn.setValue(versionQuery);
       ds.addChild(ds.getChildCount(),sn);
     }
@@ -1251,12 +1253,12 @@ public class JDBCConnector extends org.a
       int i = 0;
       while (i < ds.getChildCount())
       {
-        if (ds.getChild(i).getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+        if (ds.getChild(i).getType().equals(JDBCConstants.dataQueryNode))
           ds.removeChild(i);
         else
           i++;
       }
-      sn = new SpecificationNode(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode);
+      sn = new SpecificationNode(JDBCConstants.dataQueryNode);
       sn.setValue(dataQuery);
       ds.addChild(ds.getChildCount(),sn);
     }
@@ -1326,19 +1328,19 @@ public class JDBCConnector extends org.a
     while (i < ds.getChildCount())
     {
       SpecificationNode sn = ds.getChild(i++);
-      if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+      if (sn.getType().equals(JDBCConstants.idQueryNode))
       {
         idQuery = sn.getValue();
         if (idQuery == null)
           idQuery = "";
       }
-      else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+      else if (sn.getType().equals(JDBCConstants.versionQueryNode))
       {
         versionQuery = sn.getValue();
         if (versionQuery == null)
           versionQuery = "";
       }
-      else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+      else if (sn.getType().equals(JDBCConstants.dataQueryNode))
       {
         dataQuery = sn.getValue();
         if (dataQuery == null)
@@ -1784,19 +1786,19 @@ public class JDBCConnector extends org.a
       while (i < ds.getChildCount())
       {
         SpecificationNode sn = ds.getChild(i++);
-        if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+        if (sn.getType().equals(JDBCConstants.idQueryNode))
         {
           idQuery = sn.getValue();
           if (idQuery == null)
             idQuery = "";
         }
-        else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+        else if (sn.getType().equals(JDBCConstants.versionQueryNode))
         {
           versionQuery = sn.getValue();
           if (versionQuery == null)
             versionQuery = "";
         }
-        else if (sn.getType().equals(org.apache.manifoldcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+        else if (sn.getType().equals(JDBCConstants.dataQueryNode))
         {
           dataQuery = sn.getValue();
           if (dataQuery == null)



Mime
View raw message