manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1490585 - in /manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive: GoogleDriveRepositoryConnector.java GoogleDriveSession.java
Date Fri, 07 Jun 2013 11:13:35 GMT
Author: kwright
Date: Fri Jun  7 11:13:35 2013
New Revision: 1490585

URL: http://svn.apache.org/r1490585
Log:
Make sure secrets are obfuscated.

Modified:
    manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
    manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveSession.java

Modified: manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java?rev=1490585&r1=1490584&r2=1490585&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Fri Jun  7 11:13:35 2013
@@ -126,7 +126,6 @@ public class GoogleDriveRepositoryConnec
   protected String clientid = null;
   protected String clientsecret = null;
   protected String refreshtoken = null;
-  protected Map<String, String> parameters = new HashMap<String, String>();
 
   public GoogleDriveRepositoryConnector() {
     super();
@@ -194,7 +193,7 @@ public class GoogleDriveRepositoryConnec
     super.connect(configParams);
 
     clientid = params.getParameter(GoogleDriveConfig.CLIENT_ID_PARAM);
-    clientsecret = params.getParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM);
+    clientsecret = params.getObfuscatedParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM);
     refreshtoken = params.getParameter(GoogleDriveConfig.REFRESH_TOKEN_PARAM);
   }
 
@@ -359,13 +358,7 @@ public class GoogleDriveRepositoryConnec
     public void run() {
       try {
         // Create a session
-        parameters.clear();
-
-        // user credentials
-        parameters.put(GoogleDriveConfig.CLIENT_ID_PARAM, clientid);
-        parameters.put(GoogleDriveConfig.CLIENT_SECRET_PARAM, clientsecret);
-        parameters.put(GoogleDriveConfig.REFRESH_TOKEN_PARAM, refreshtoken);
-        session = new GoogleDriveSession(parameters);
+        session = new GoogleDriveSession(clientid, clientsecret, refreshtoken);
       } catch (Throwable e) {
         this.exception = e;
       }
@@ -420,7 +413,7 @@ public class GoogleDriveRepositoryConnec
    */
   private static void fillInServerConfigurationMap(Map<String, Object> newMap, ConfigParams
parameters) {
     String clientid = parameters.getParameter(GoogleDriveConfig.CLIENT_ID_PARAM);
-    String clientsecret = parameters.getParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM);
+    String clientsecret = parameters.getObfuscatedParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM);
     String refreshtoken = parameters.getParameter(GoogleDriveConfig.REFRESH_TOKEN_PARAM);
 
     if (clientid == null) {
@@ -539,7 +532,7 @@ public class GoogleDriveRepositoryConnec
 
     String clientsecret = variableContext.getParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM);
     if (clientsecret != null) {
-      parameters.setParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM, clientsecret);
+      parameters.setObfuscatedParameter(GoogleDriveConfig.CLIENT_SECRET_PARAM, clientsecret);
     }
 
     String refreshtoken = variableContext.getParameter(GoogleDriveConfig.REFRESH_TOKEN_PARAM);

Modified: manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveSession.java?rev=1490585&r1=1490584&r2=1490585&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveSession.java
(original)
+++ manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveSession.java
Fri Jun  7 11:13:35 2013
@@ -62,12 +62,12 @@ public class GoogleDriveSession {
   
   /** Constructor.  Create a session.
   */
-  public GoogleDriveSession(Map<String, String> parameters)
+  public GoogleDriveSession(String clientId, String clientSecret, String refreshToken)
     throws IOException, GeneralSecurityException {
     HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
 
-    GoogleCredential credentials = new GoogleCredential.Builder().setClientSecrets(parameters.get("clientid"),
parameters.get("clientsecret"))
-        .setJsonFactory(JSON_FACTORY).setTransport(HTTP_TRANSPORT).build().setRefreshToken(parameters.get("refreshtoken"));
+    GoogleCredential credentials = new GoogleCredential.Builder().setClientSecrets(clientId,
clientSecret)
+        .setJsonFactory(JSON_FACTORY).setTransport(HTTP_TRANSPORT).build().setRefreshToken(refreshToken);
 
     drive = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credentials).setApplicationName(APPNAME).build();
   }



Mime
View raw message