Example usage for org.apache.maven.settings.crypto SettingsDecryptionResult getProxy

List of usage examples for org.apache.maven.settings.crypto SettingsDecryptionResult getProxy

Introduction

In this page you can find the example usage for org.apache.maven.settings.crypto SettingsDecryptionResult getProxy.

Prototype

Proxy getProxy();

Source Link

Document

Gets the decrypted proxy.

Usage

From source file:com.basistech.ReleaseNoteMojo.java

License:Open Source License

private void setupProxy(Invocation.Builder target) throws MojoExecutionException {
    Proxy proxy = getProxy(settings, serverId);
    if (null != proxy) {
        ClientConfiguration cxfConfig = WebClient.getConfig(target);
        Conduit conduit = cxfConfig.getConduit();

        try {/*from  w  ww  .  j a  v a  2  s  .com*/
            SettingsDecrypter settingsDecrypter = container.lookup(SettingsDecrypter.class);
            SettingsDecryptionResult result = settingsDecrypter
                    .decrypt(new DefaultSettingsDecryptionRequest(proxy));
            proxy = result.getProxy();
        } catch (ComponentLookupException cle) {
            throw new MojoExecutionException("Unable to lookup SettingsDecrypter: " + cle.getMessage(), cle);
        }
        getLog().debug(MessageFormat.format("Found Proxy {0}:{1}", proxy.getHost(), proxy.getPort()));
        HTTPConduit http = (HTTPConduit) conduit;
        http.getClient().setProxyServer(proxy.getHost());
        http.getClient().setProxyServerPort(proxy.getPort());
        http.getProxyAuthorization().setUserName(proxy.getUsername());
        http.getProxyAuthorization().setPassword(proxy.getPassword());
    }
}

From source file:io.wcm.devops.conga.plugins.aem.maven.ProxySupport.java

License:Apache License

private static Proxy decryptProxy(Proxy proxy, SettingsDecrypter decrypter) {
    final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(proxy);
    SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest);
    return decryptedResult.getProxy();
}

From source file:org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.java

License:Open Source License

private void setProxy(ProxyServiceFacade proxyService, Proxy proxy) {
    String protocol = proxy.getProtocol();

    if (isSupportedProtocol(protocol)) {

        SettingsDecryptionResult result = decrypter.decryptAndLogProblems(proxy);
        proxy = result.getProxy();
        logger.debug("Configuring proxy for protocol " + protocol + ": host=" + proxy.getHost() + ", port="
                + proxy.getPort() + ", nonProxyHosts=" + proxy.getNonProxyHosts());
        proxyService.configureProxy(protocol, proxy.getHost(), proxy.getPort(), proxy.getUsername(),
                proxy.getPassword(), proxy.getNonProxyHosts());

    } else {/*  w ww.j  av  a  2  s . c  om*/
        logger.debug("Ignoring proxy configuration for unsupported protocol: '" + protocol + "'");
    }
}