summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPascal Rapicault2012-11-09 22:45:15 (EST)
committer jsievers2012-11-27 11:07:36 (EST)
commit974e9c11e8b1534460bdde0622d6387c08f2c1bf (patch)
treebce645716e0481471bbf234afe2f43896f6e717c
parentde6e2cb9003bdbd373fb8833eca458a02458a130 (diff)
downloadorg.eclipse.tycho-974e9c11e8b1534460bdde0622d6387c08f2c1bf.zip
org.eclipse.tycho-974e9c11e8b1534460bdde0622d6387c08f2c1bf.tar.gz
org.eclipse.tycho-974e9c11e8b1534460bdde0622d6387c08f2c1bf.tar.bz2
386910 Decrypt repository passwordrefs/changes/35/8635/3
Passwords encrypted in settings.xml were not decrypted causing failure to connect to the repo. Bug: 386910 Change-Id: Icf2fe30ee64126726525585a68e55bbaa3c411f8
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/RepositorySettingsConfigurator.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/RepositorySettingsConfigurator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/RepositorySettingsConfigurator.java
index e5cae33..4c6ef0f 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/RepositorySettingsConfigurator.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/RepositorySettingsConfigurator.java
@@ -19,6 +19,10 @@ import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Server;
+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;
@@ -45,6 +49,9 @@ public class RepositorySettingsConfigurator extends EquinoxLifecycleListener {
@Requirement(hint = "p2")
private ArtifactRepositoryLayout p2layout;
+ @Requirement
+ private SettingsDecrypter decrypter;
+
@Override
public void afterFrameworkStarted(EmbeddedEquinox framework) {
framework.registerService(MavenRepositorySettings.class, new MavenRepositorySettingsProvider());
@@ -77,12 +84,20 @@ public class RepositorySettingsConfigurator extends EquinoxLifecycleListener {
Server serverSettings = context.getSession().getSettings().getServer(location.getId());
if (serverSettings != null) {
- return new MavenRepositorySettings.Credentials(serverSettings.getUsername(),
- serverSettings.getPassword());
+ DefaultSettingsDecryptionRequest decryptRequest = new DefaultSettingsDecryptionRequest(serverSettings);
+ SettingsDecryptionResult result = decrypter.decrypt(decryptRequest);
+ Server decryptedServerSettings = result.getServer();
+ if (decryptedServerSettings == null) {
+ for (SettingsProblem problem : result.getProblems()) {
+ logger.info(problem.toString());
+ }
+ return null;
+ }
+ return new MavenRepositorySettings.Credentials(decryptedServerSettings.getUsername(),
+ decryptedServerSettings.getPassword());
}
return null;
}
-
}
}