static Server decryptServer(String serverId, MavenSession mavenSession, SettingsDecrypter decrypter) { if (StringUtils.isEmpty(serverId)) { return null; } Server server = mavenSession.getSettings().getServer(serverId); if (server != null) { final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server); SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest); return decryptedResult.getServer(); } else { LOGGER.warn("Could not find server '" + serverId + "' in settings.xml"); return null; } }
private void decryptSettings() { SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( m_settings ); SettingsDecryptionResult result = decrypter.decrypt( request ); m_settings.setProxies(result.getProxies()); m_settings.setServers( result.getServers() ); }
private static Proxy decryptProxy(Proxy proxy, SettingsDecrypter decrypter) { final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(proxy); SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest); return decryptedResult.getProxy(); }
private RegistryAuth createRegistryAuth(Server server) throws DockerException { SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server); SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt(decryptionRequest); if (decryptionResult.getProblems().isEmpty()) { log.debug("Successfully decrypted Maven server password"); } else { for (SettingsProblem problem : decryptionResult.getProblems()) { log.error("Settings problem for server {}: {}", server.getId(), problem); } throw new DockerException("Failed to decrypt Maven server password"); } return RegistryAuth.builder() .username(server.getUsername()) .password(decryptionResult.getServer().getPassword()) .build(); } }
private SettingsDecryptionResult decryptSettings(Settings settings) { DefaultSettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( settings); return createSettingsDecrypter().decrypt(request); }
DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest(); decrypt.setProxies( request.getProxies() ); decrypt.setServers( request.getServers() ); SettingsDecryptionResult decrypted = settingsDecrypter.decrypt( decrypt ); for ( SettingsProblem problem : decrypted.getProblems() ) for ( Proxy proxy : decrypted.getProxies() ) for ( Server server : decrypted.getServers() )
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( proxy ); SettingsDecryptionResult result = settingsDecrypter.decrypt( request ); proxy = result.getProxy(); for ( SettingsProblem problem : result.getProblems() )
/** * Returns the list of servers with decrypted passwords. * * @return list of servers with decrypted passwords. */ List<Server> getDecryptedServers() { final SettingsDecryptionRequest settingsDecryptionRequest = new DefaultSettingsDecryptionRequest(); settingsDecryptionRequest.setServers(settings.getServers()); final SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(settingsDecryptionRequest); return decrypt.getServers(); }
private SettingsDecryptionResult decryptAndLogProblems(SettingsDecryptionRequest decryptRequest) { SettingsDecryptionResult result = decrypter.decrypt(decryptRequest); logProblems(result); return result; }
private Settings decryptPasswords(Settings settings) { File securitySettings = new File(DEFAULT_SETTINGS_SECURITY_PATH); String altSecuritySettings = SecurityActions.getProperty(ALT_SECURITY_SETTINGS_XML_LOCATION); // set alternate file if (altSecuritySettings != null && altSecuritySettings.length() > 0) { securitySettings = new File(altSecuritySettings); } SettingsDecrypter decrypter = new MavenSettingsDecrypter(securitySettings); SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(settings); SettingsDecryptionResult result = decrypter.decrypt(request); if (result.getProblems().size() > 0) { StringBuilder sb = new StringBuilder("Found ").append(result.getProblems().size()) .append(" problems while trying to decrypt settings configuration."); int counter = 1; for (SettingsProblem problem : result.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new InvalidConfigurationFileException(sb.toString()); } settings.setProxies(result.getProxies()); settings.setServers(result.getServers()); return settings; }
settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( proxy ) ); proxy = result.getProxy();
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( server ); SettingsDecryptionResult result = settingsDecrypter.decrypt( request ); server = result.getServer(); for ( SettingsProblem problem : result.getProblems() )
private SettingsDecryptionResult decryptSettings(Settings settings) { DefaultSettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( settings); return createSettingsDecrypter().decrypt(request); }
private Settings decryptPasswords(Settings settings) { File securitySettings = new File(DEFAULT_SETTINGS_SECURITY_PATH); String altSecuritySettings = SecurityActions.getProperty(ALT_SECURITY_SETTINGS_XML_LOCATION); // set alternate file if (altSecuritySettings != null && altSecuritySettings.length() > 0) { securitySettings = new File(altSecuritySettings); } SettingsDecrypter decrypter = new MavenSettingsDecrypter(securitySettings); SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(settings); SettingsDecryptionResult result = decrypter.decrypt(request); if (result.getProblems().size() > 0) { StringBuilder sb = new StringBuilder("Found ").append(result.getProblems().size()) .append(" problems while trying to decrypt settings configuration."); int counter = 1; for (SettingsProblem problem : result.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new InvalidConfigurationFileException(sb.toString()); } settings.setProxies(result.getProxies()); settings.setServers(result.getServers()); return settings; }
settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( server ) ); server = result.getServer();
private static Proxy decryptProxy(Proxy proxy, SettingsDecrypter decrypter) { final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(proxy); SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest); return decryptedResult.getProxy(); } }
public Server decryptPassword(Server server) throws MavenException { SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(server); SettingsDecryptionResult result = lookup(SettingsDecrypter.class).decrypt(request); for (SettingsProblem problem : result.getProblems()) { log.warn(problem.getMessage(), problem.getException()); } return result.getServer(); }
private SettingsDecryptionResult decryptSettings(Settings settings) { DefaultSettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( settings); return createSettingsDecrypter().decrypt(request); }
securityDispatcherField.setAccessible(true); securityDispatcherField.set(settingsDecrypter, secDispatcher); final SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(effectiveSettings); final SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt(decryptionRequest); if (!decryptionResult.getProblems().isEmpty()) throw decryptionResult.getProblems().get(0).getException(); effectiveSettings.setServers(decryptionResult.getServers()); effectiveSettings.setProxies(decryptionResult.getProxies());
private String decrypt(final Server server) { SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(server)); return decrypt.getServer().getPassword(); } }