use of org.apache.maven.settings.crypto.SettingsDecryptionResult in project maven-archetype by apache.
the class RemoteCatalogArchetypeDataSource method getProxy.
private ProxyInfo getProxy(String protocol) {
MavenSession session = legacySupport.getSession();
if (session != null && protocol != null) {
MavenExecutionRequest request = session.getRequest();
if (request != null) {
List<Proxy> proxies = request.getProxies();
if (proxies != null) {
for (Proxy proxy : proxies) {
if (proxy.isActive() && protocol.equalsIgnoreCase(proxy.getProtocol())) {
SettingsDecryptionResult result = settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(proxy));
proxy = result.getProxy();
ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setHost(proxy.getHost());
proxyInfo.setType(proxy.getProtocol());
proxyInfo.setPort(proxy.getPort());
proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts());
proxyInfo.setUserName(proxy.getUsername());
proxyInfo.setPassword(proxy.getPassword());
return proxyInfo;
}
}
}
}
}
return null;
}
use of org.apache.maven.settings.crypto.SettingsDecryptionResult in project frontend-maven-plugin by eirslett.
the class MojoUtils method decryptServer.
static Server decryptServer(String serverId, MavenSession mavenSession, SettingsDecrypter decrypter) {
if (StringUtils.isEmpty(serverId)) {
return null;
}
Server server = mavenSession.getSettings().getServer(serverId);
if (server != null) {
synchronized (server) {
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;
}
}
Aggregations