use of org.apache.maven.settings.crypto.DefaultSettingsDecrypter in project spring-boot by spring-projects.
the class MavenSettingsReader method createSettingsDecrypter.
private SettingsDecrypter createSettingsDecrypter() {
SettingsDecrypter settingsDecrypter = new DefaultSettingsDecrypter();
setField(DefaultSettingsDecrypter.class, "securityDispatcher", settingsDecrypter, new SpringBootSecDispatcher());
return settingsDecrypter;
}
use of org.apache.maven.settings.crypto.DefaultSettingsDecrypter in project karaf by apache.
the class MavenConfigurationSupport method decryptSettings.
/**
* <p>Decrypts passwords inside correctly read <code>settings.xml</code>. Also tries to decrypt master password.</p>
* <p>Not called implicitly for each action invocation.</p>
*/
private void decryptSettings() throws Exception {
if (mavenSecuritySettings != null && mavenSettings != null) {
masterPassword = cipher.decryptDecorated(mavenSecuritySettings.getMaster(), masterMasterPassword);
DefaultSecDispatcher dispatcher = new DefaultSecDispatcher();
DefaultSettingsDecrypter decrypter = new DefaultSettingsDecrypter();
try {
dispatcher.setConfigurationFile(securitySettings.value.getAbsolutePath());
Field f = dispatcher.getClass().getDeclaredField("_cipher");
f.setAccessible(true);
f.set(dispatcher, cipher);
f = decrypter.getClass().getDeclaredField("securityDispatcher");
f.setAccessible(true);
f.set(decrypter, dispatcher);
DefaultSettingsDecryptionRequest req = new DefaultSettingsDecryptionRequest(mavenSettings);
SettingsDecryptionResult res = decrypter.decrypt(req);
if (res.getProblems() != null && res.getProblems().size() > 0) {
for (SettingsProblem sp : res.getProblems()) {
System.err.println(sp);
}
}
for (Proxy proxy : res.getProxies()) {
if (!cipher.isEncryptedString(proxy.getPassword())) {
proxyPasswords.put(proxy.getId(), proxy.getPassword());
}
}
for (Server server : res.getServers()) {
if (!cipher.isEncryptedString(server.getPassword())) {
serverPasswords.put(server.getId(), server.getPassword());
}
}
} catch (Throwable t) {
LOG.warn("Can't decrypt " + securitySettings.value, t);
}
}
}
use of org.apache.maven.settings.crypto.DefaultSettingsDecrypter in project spring-cloud-function by spring-cloud.
the class MavenSettingsReader method createSettingsDecrypter.
private SettingsDecrypter createSettingsDecrypter() {
SettingsDecrypter settingsDecrypter = new DefaultSettingsDecrypter();
setField(DefaultSettingsDecrypter.class, "securityDispatcher", settingsDecrypter, new SpringBootSecDispatcher());
return settingsDecrypter;
}
Aggregations