Author: kwright
Date: Tue Aug 27 21:15:17 2019
New Revision: 1866009
URL: http://svn.apache.org/viewvc?rev=1866009&view=rev
Log:
More improvements
Modified:
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IKeystoreManager.java
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/keystore/KeystoreManager.java
Modified:
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java?rev=1866009&r1=1866008&r2=1866009&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
(original)
+++
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
Tue Aug 27 21:15:17 2019
@@ -1279,8 +1279,8 @@ public class CswsConnector extends org.a
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("Csws: Decided to ingest document "+objID);
- // Grab the access tokens for this file from the version string,
inside ingest method.
- ingestFromCsws(llc, documentIdentifier, versionString, actualAcls,
denyAcls, categoryPaths, activities, desc, sDesc);
+ // Index it
+ ingestFromCsws(llc, documentIdentifier, versionString, actualAcls,
denyAcls, rights.getOwnerRight().getRightID(), categoryPaths, activities, desc,
sDesc);
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("Csws: Done processing document "+objID);
@@ -2682,6 +2682,7 @@ public class CswsConnector extends org.a
protected void ingestFromCsws(CswsContext llc,
String documentIdentifier, String version,
String[] actualAcls, String[] denyAcls,
+ long ownerID,
String[] categoryPaths,
IProcessActivity activities,
MetadataDescription desc, SystemMetadataDescription sDesc)
@@ -2817,13 +2818,12 @@ public class CswsConnector extends org.a
rd.addField(GENERAL_MODIFYDATE_FIELD,DateParser.formatISO8601Date(modifyDate));
if (parentID != null)
rd.addField(GENERAL_PARENTID,parentID.toString());
- // TBD: this comes from NodeRights now, e.g
cswsSession.getNodeRights(docId)
- //UserInformation owner = llc.getUserInformation(objInfo.getOwnerId());
+
+ UserInformation owner = llc.getUserInformation(ownerID); // from
ObjectRights
UserInformation creator = llc.getUserInformation(objInfo.getCreatorId());
UserInformation modifier = llc.getUserInformation(versInfo.getOwnerId());
- // TBD
- //if (owner != null)
- // rd.addField(GENERAL_OWNER,owner.getName());
+ if (owner != null)
+ rd.addField(GENERAL_OWNER,owner.getName());
if (creator != null)
rd.addField(GENERAL_CREATOR,creator.getName());
if (modifier != null)
Modified:
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java?rev=1866009&r1=1866008&r2=1866009&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
(original)
+++
manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
Tue Aug 27 21:15:17 2019
@@ -28,6 +28,10 @@ import java.net.MalformedURLException;
import java.io.OutputStream;
import java.io.IOException;
+import org.apache.cxf.transport.http.HttpConduitFeature;
+import org.apache.cxf.transport.http.HttpConduitConfig;
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
+
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
@@ -139,6 +143,12 @@ public class CswsSession
this.password = password;
// Save expiration interval
this.sessionExpirationInterval = sessionExpirationInterval;
+ // Build TLSClientParameters
+ final TLSClientParameters tlsConfig = new TLSClientParameters();
+ // Build configuration for conduit
+ final HttpConduitConfig config = new HttpConduitConfig();
+ config.setTlsClientParameters(tlsConfig);
+
// Construct service references from the URLs
try {
this.authService = new Authentication_Service(new
URL(authenticationServiceURL));
Modified:
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IKeystoreManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IKeystoreManager.java?rev=1866009&r1=1866008&r2=1866009&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IKeystoreManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/interfaces/IKeystoreManager.java
Tue Aug 27 21:15:17 2019
@@ -20,6 +20,7 @@
package org.apache.manifoldcf.connectorcommon.interfaces;
import org.apache.manifoldcf.core.interfaces.*;
+import javax.net.ssl.TrustManager;
import java.io.*;
/** This interface describes a class that manages keys and certificates in a
secure manner.
@@ -80,4 +81,8 @@ public interface IKeystoreManager extend
public void addCertificate(String alias, java.security.cert.Certificate
certificate)
throws ManifoldCFException;
+ /** Get the trust stores for this keystore manager.
+ */
+ public TrustManager[] getTrustManagers()
+ throws ManifoldCFException;
}
Modified:
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/keystore/KeystoreManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/keystore/KeystoreManager.java?rev=1866009&r1=1866008&r2=1866009&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/keystore/KeystoreManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-1566/framework/connector-common/src/main/java/org/apache/manifoldcf/connectorcommon/keystore/KeystoreManager.java
Tue Aug 27 21:15:17 2019
@@ -22,6 +22,8 @@ import org.apache.manifoldcf.core.interf
import org.apache.manifoldcf.connectorcommon.interfaces.*;
import org.apache.manifoldcf.core.common.*;
import org.apache.manifoldcf.core.system.Logging;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
import java.security.*;
import java.security.cert.*;
import java.security.cert.Certificate;
@@ -317,11 +319,10 @@ public class KeystoreManager implements
}
}
- /** Build a secure socket factory based on this keystore.
+ /** Get the trust stores for this keystore manager.
*/
@Override
- public javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
- throws ManifoldCFException
+ public TrustManager[] getTrustManagers() throws ManifoldCFException
{
try
{
@@ -330,7 +331,7 @@ public class KeystoreManager implements
// javax.net.ssl.KeyManagerFactory keyManagerFactory =
javax.net.ssl.KeyManagerFactory.getInstance(javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm());
// keyManagerFactory.init(keystore,passcode);
- javax.net.ssl.TrustManagerFactory trustManagerFactory =
javax.net.ssl.TrustManagerFactory.getInstance(javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm());
+ TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
Logging.keystore.debug("Contents of current trust keystore is:");
if (Logging.keystore.isDebugEnabled())
{
@@ -347,7 +348,7 @@ public class KeystoreManager implements
if (Logging.keystore.isDebugEnabled())
{
Logging.keystore.debug("...done");
- javax.net.ssl.TrustManager array[] =
trustManagerFactory.getTrustManagers();
+ TrustManager array[] = trustManagerFactory.getTrustManagers();
Logging.keystore.debug("Found "+Integer.toString(array.length)+" trust
managers");
int i = 0;
while (i < array.length)
@@ -372,11 +373,36 @@ public class KeystoreManager implements
Logging.keystore.debug("No more trust contents");
}
+ return
(trustManagerFactory==null)?null:trustManagerFactory.getTrustManagers();
+ }
+ catch (java.security.NoSuchAlgorithmException e)
+ {
+ throw new ManifoldCFException("No such algorithm: "+e.getMessage(),e);
+ }
+ catch (java.security.KeyStoreException e)
+ {
+ throw new ManifoldCFException("Keystore exception: "+e.getMessage(),e);
+ }
+ }
+
+ /** Build a secure socket factory based on this keystore.
+ */
+ @Override
+ public javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
+ throws ManifoldCFException
+ {
+ try
+ {
+ // Construct a key manager and a trust manager
+ javax.net.ssl.KeyManagerFactory keyManagerFactory = null;
+ // javax.net.ssl.KeyManagerFactory keyManagerFactory =
javax.net.ssl.KeyManagerFactory.getInstance(javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm());
+ // keyManagerFactory.init(keystore,passcode);
+
java.security.SecureRandom secureRandom =
java.security.SecureRandom.getInstance("SHA1PRNG");
// Create an SSL context
javax.net.ssl.SSLContext sslContext =
javax.net.ssl.SSLContext.getInstance("SSL");
-
sslContext.init(((keyManagerFactory==null)?null:keyManagerFactory.getKeyManagers()),((trustManagerFactory==null)?null:trustManagerFactory.getTrustManagers()),
+
sslContext.init(((keyManagerFactory==null)?null:keyManagerFactory.getKeyManagers()),getTrustManagers(),
secureRandom);
return sslContext.getSocketFactory();
@@ -385,10 +411,6 @@ public class KeystoreManager implements
{
throw new ManifoldCFException("No such algorithm: "+e.getMessage(),e);
}
- catch (java.security.KeyStoreException e)
- {
- throw new ManifoldCFException("Keystore exception: "+e.getMessage(),e);
- }
catch (java.security.KeyManagementException e)
{
throw new ManifoldCFException("Key management exception:
"+e.getMessage(),e);