List of usage examples for org.apache.maven.settings.crypto SettingsDecryptionRequest setServers
SettingsDecryptionRequest setServers(List<Server> servers);
From source file:com.isomorphic.maven.mojo.DeployMojo.java
License:Apache License
/** * Decrypt settings and return the server element with the given id. Useful for e.g., reading encrypted * user credentials./*from w ww. ja v a2 s . c o m*/ * * @param id the id of the server to be decrypted * @return a Server with its protected elements decrypted, if one is found with the given id. Null otherwise. * * @see http://maven.apache.org/guides/mini/guide-encryption.html */ private Server getDecryptedServer(String id) { final SettingsDecryptionRequest settingsDecryptionRequest = new DefaultSettingsDecryptionRequest(); settingsDecryptionRequest.setServers(settings.getServers()); final SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(settingsDecryptionRequest); List<Server> servers = decrypt.getServers(); for (Server server : servers) { if (server.getId().equals(id)) { return server; } } return null; }
From source file:com.mycila.maven.plugin.license.AbstractLicenseMojo.java
License:Apache License
/** * Returns the list of servers with decrypted passwords. * * @return list of servers with decrypted passwords. */// ww w . j a v a2s . com List<Server> getDecryptedServers() { final SettingsDecryptionRequest settingsDecryptionRequest = new DefaultSettingsDecryptionRequest(); settingsDecryptionRequest.setServers(settings.getServers()); final SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(settingsDecryptionRequest); return decrypt.getServers(); }
From source file:com.sap.research.maven.plugin.nwcloud.NWCloudGetPwd.java
License:Apache License
/** * Returns List of Server objects defined by Maven settings having the passwords decrypted. * @return List of Servers with decrypted passwords. *//*from ww w . ja v a 2s .c o m*/ private List<Server> getDecryptedServers() { List<Server> result = null; if (settings != null) { result = settings.getServers(); if (result != null) { if (settingsDecrypter != null) { SettingsDecryptionRequest settingsDecryptionRequest = new DefaultSettingsDecryptionRequest(); settingsDecryptionRequest.setServers(result); SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(settingsDecryptionRequest); result = decrypt.getServers(); } else { getLog().info( "Cannot decrypt the server settings as the SettingsDecrypter provided by Maven is null."); } } else { getLog().info("Servers defined in Maven settings are null."); } } else { getLog().info("Maven settings are null."); } return result; }