aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-11-09 22:47:20 (EST)
committerjsievers2012-11-28 14:01:47 (EST)
commit4d57bd74affbbc1293592f356d28086621b4be24 (patch)
tree1c924553b1973fe08ef5f8d23727f85ea8a0cef6
parent738bf03d7fe5dec104a3ed9f701dd8a6f6013ded (diff)
downloadorg.eclipse.tycho-4d57bd74affbbc1293592f356d28086621b4be24.zip
org.eclipse.tycho-4d57bd74affbbc1293592f356d28086621b4be24.tar.gz
org.eclipse.tycho-4d57bd74affbbc1293592f356d28086621b4be24.tar.bz2
394023 - Decrypt proxy passwordsrefs/changes/36/8636/2
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java
index 0a5238b..d4a2e19 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java
@@ -15,6 +15,10 @@ import java.util.Locale;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.building.SettingsProblem;
+import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
+import org.apache.maven.settings.crypto.SettingsDecrypter;
+import org.apache.maven.settings.crypto.SettingsDecryptionResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
@@ -30,6 +34,9 @@ public class OSGiProxyConfigurator extends EquinoxLifecycleListener {
@Requirement
private LegacySupport context;
+ @Requirement
+ private SettingsDecrypter decrypter;
+
@Override
public void afterFrameworkStarted(EmbeddedEquinox framework) {
MavenSession session = context.getSession();
@@ -58,6 +65,15 @@ public class OSGiProxyConfigurator extends EquinoxLifecycleListener {
logger.debug("Configuring proxy for protocol " + protocol + ": host=" + proxy.getHost() + ", port="
+ proxy.getPort() + ", nonProxyHosts=" + proxy.getNonProxyHosts() + "");
+ DefaultSettingsDecryptionRequest decryptRequest = new DefaultSettingsDecryptionRequest(proxy);
+ SettingsDecryptionResult result = decrypter.decrypt(decryptRequest);
+ proxy = result.getProxy() != null ? result.getProxy() : proxy;
+ if (result.getProxy() == null) {
+ for (SettingsProblem problem : result.getProblems()) {
+ logger.info(problem.toString());
+ }
+ }
+
proxyService.configureProxy(protocol, proxy.getHost(), proxy.getPort(), proxy.getUsername(),
proxy.getPassword(), proxy.getNonProxyHosts());