manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1503139 - in /manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf: authorities/authorities/jira/JiraAuthorityConnector.java crawler/connectors/jira/JiraRepositoryConnector.java
Date Mon, 15 Jul 2013 08:47:45 GMT
Author: kwright
Date: Mon Jul 15 08:47:45 2013
New Revision: 1503139

URL: http://svn.apache.org/r1503139
Log:
Make Jira connector password secure.

Modified:
    manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
    manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java

Modified: manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java?rev=1503139&r1=1503138&r2=1503139&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
Mon Jul 15 08:47:45 2013
@@ -39,6 +39,7 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
 import org.apache.manifoldcf.core.interfaces.IPostParameters;
 import org.apache.manifoldcf.core.interfaces.IThreadContext;
 import java.util.Map.Entry;
@@ -218,7 +219,7 @@ public class JiraAuthorityConnector exte
    * @param newMap is the map to fill in
    * @param parameters is the current set of configuration parameters
    */
-  private static void fillInServerConfigurationMap(Map<String, Object> newMap, ConfigParams
parameters) {
+  private static void fillInServerConfigurationMap(Map<String, Object> newMap, IPasswordMapperActivity
mapper, ConfigParams parameters) {
     String jiraprotocol = parameters.getParameter(JiraConfig.JIRA_PROTOCOL_PARAM);
     String jirahost = parameters.getParameter(JiraConfig.JIRA_HOST_PARAM);
     String jiraport = parameters.getParameter(JiraConfig.JIRA_PORT_PARAM);
@@ -239,6 +240,8 @@ public class JiraAuthorityConnector exte
       clientid = JiraConfig.CLIENT_ID_DEFAULT;
     if (clientsecret == null)
       clientsecret = JiraConfig.CLIENT_SECRET_DEFAULT;
+    else
+      clientsecret = mapper.mapPasswordToKey(clientsecret);
 
     newMap.put("JIRAPROTOCOL", jiraprotocol);
     newMap.put("JIRAHOST", jirahost);
@@ -266,7 +269,7 @@ public class JiraAuthorityConnector exte
     Map<String, Object> paramMap = new HashMap<String, Object>();
 
     // Fill in map from each tab
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
 
     Messages.outputResourceWithVelocity(out,locale,VIEW_CONFIG_FORWARD,paramMap);
   }
@@ -295,7 +298,7 @@ public class JiraAuthorityConnector exte
     Map<String, Object> paramMap = new HashMap<String, Object>();
 
     // Fill in the parameters from each tab
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
 
     // Output the Javascript - only one Velocity template for all tabs
     Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_HEADER_FORWARD,paramMap);
@@ -314,7 +317,7 @@ public class JiraAuthorityConnector exte
 
     // Server tab
     // Fill in the parameters
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
     Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_FORWARD_SERVER,paramMap);
   }
 
@@ -362,7 +365,7 @@ public class JiraAuthorityConnector exte
 
     String clientsecret = variableContext.getParameter("clientsecret");
     if (clientsecret != null)
-      parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, clientsecret);
+      parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, variableContext.mapKeyToPassword(clientsecret));
 
     return null;
   }

Modified: manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java?rev=1503139&r1=1503138&r2=1503139&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-737/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
Mon Jul 15 08:47:45 2013
@@ -42,6 +42,7 @@ import org.apache.manifoldcf.core.interf
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
 import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
 import org.apache.manifoldcf.core.interfaces.IPostParameters;
 import org.apache.manifoldcf.core.interfaces.IThreadContext;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
@@ -314,7 +315,7 @@ public class JiraRepositoryConnector ext
    * @param newMap is the map to fill in
    * @param parameters is the current set of configuration parameters
    */
-  private static void fillInServerConfigurationMap(Map<String, Object> newMap, ConfigParams
parameters) {
+  private static void fillInServerConfigurationMap(Map<String, Object> newMap, IPasswordMapperActivity
mapper, ConfigParams parameters) {
     String jiraprotocol = parameters.getParameter(JiraConfig.JIRA_PROTOCOL_PARAM);
     String jirahost = parameters.getParameter(JiraConfig.JIRA_HOST_PARAM);
     String jiraport = parameters.getParameter(JiraConfig.JIRA_PORT_PARAM);
@@ -335,6 +336,8 @@ public class JiraRepositoryConnector ext
       clientid = JiraConfig.CLIENT_ID_DEFAULT;
     if (clientsecret == null)
       clientsecret = JiraConfig.CLIENT_SECRET_DEFAULT;
+    else
+      clientsecret = mapper.mapPasswordToKey(clientsecret);
 
     newMap.put("JIRAPROTOCOL", jiraprotocol);
     newMap.put("JIRAHOST", jirahost);
@@ -362,7 +365,7 @@ public class JiraRepositoryConnector ext
     Map<String, Object> paramMap = new HashMap<String, Object>();
 
     // Fill in map from each tab
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
 
     Messages.outputResourceWithVelocity(out,locale,VIEW_CONFIG_FORWARD,paramMap);
   }
@@ -391,7 +394,7 @@ public class JiraRepositoryConnector ext
     Map<String, Object> paramMap = new HashMap<String, Object>();
 
     // Fill in the parameters from each tab
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
 
     // Output the Javascript - only one Velocity template for all tabs
     Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_HEADER_FORWARD,paramMap);
@@ -410,7 +413,7 @@ public class JiraRepositoryConnector ext
 
     // Server tab
     // Fill in the parameters
-    fillInServerConfigurationMap(paramMap, parameters);
+    fillInServerConfigurationMap(paramMap, out, parameters);
     Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_FORWARD_SERVER,paramMap);
   }
 
@@ -458,7 +461,7 @@ public class JiraRepositoryConnector ext
 
     String clientsecret = variableContext.getParameter("clientsecret");
     if (clientsecret != null)
-      parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, clientsecret);
+      parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, variableContext.mapKeyToPassword(clientsecret));
 
     return null;
   }



Mime
View raw message