Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2018-02-23 09:19:57 -0500
committerMatthew Piggott2018-02-23 09:19:57 -0500
commitc4e4eba221dfa249d267af714fdc3b440edd9196 (patch)
treeae5bc9b77e2e333cfc1defa1a8007137dc8b13cb /org.eclipse.m2e.core
parent8f52b072885970b7321fd396fea20ede612d8543 (diff)
downloadm2e-core-c4e4eba221dfa249d267af714fdc3b440edd9196.tar.gz
m2e-core-c4e4eba221dfa249d267af714fdc3b440edd9196.tar.xz
m2e-core-c4e4eba221dfa249d267af714fdc3b440edd9196.zip
531565 - Use default SSLContext for AetherClientResourceFetcher
Change-Id: Idef40222289e1e6f07014e61d01f04538c1176ab Signed-off-by: Matthew Piggott <matthew@piggott.ca>
Diffstat (limited to 'org.eclipse.m2e.core')
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java15
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties1
3 files changed, 18 insertions, 0 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
index 3cd24b0d..18f0df12 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
@@ -38,6 +38,8 @@ public class Messages extends NLS {
public static String AbstractTransferListenerAdapter_subtask;
+ public static String AetherClientConfigAdapter_error_sslContext;
+
public static String ArchetypeCatalogFactory_default_local;
public static String ArchetypeCatalogFactory_error_missing_catalog;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
index cf2767c5..16a5b901 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
@@ -18,9 +18,15 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
+import javax.net.ssl.SSLContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
@@ -30,6 +36,7 @@ import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.Messages;
import io.takari.aether.client.AetherClient;
import io.takari.aether.client.AetherClientAuthentication;
@@ -88,6 +95,7 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher {
}
class AetherClientConfigAdapter extends AetherClientConfig {
+ private final Logger log = LoggerFactory.getLogger(AetherClientConfigAdapter.class);
int connectionTimeout;
@@ -107,6 +115,13 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher {
this.proxyInfo = proxyInfo;
this.userAgent = userAgent;
this.headers = headers;
+
+ try {
+ // ensure JVM's trust & key stores are used
+ setSslSocketFactory(SSLContext.getDefault().getSocketFactory());
+ } catch(NoSuchAlgorithmException ex) {
+ log.warn(Messages.AetherClientConfigAdapter_error_sslContext);
+ }
}
public String getUserAgent() {
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
index cbfb0fa2..6dbbb3d9 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
@@ -7,6 +7,7 @@ AbstractTransferListenerAdapter_cancelled=Transfer is canceled
AbstractTransferListenerAdapter_kb=KB
AbstractTransferListenerAdapter_mb=MB
AbstractTransferListenerAdapter_subtask=error {0}
+AetherClientConfigAdapter_error_sslContext=Unable to use default SSLContext. JVM truststore & keystore will not be used.
AnnotationMappingMetadataSource_ErrorParsingInstruction=Error parsing lifecycle processing instructions
AnnotationMappingMetadataSource_UnsupportedInstructionFormat=Unsupported instruction format
ArchetypeCatalogFactory_default_local=Default Local

Back to the top