&& !StringUtils.isEmpty(remoteProxySettings.getHttpProxySettings().getProxyHostname())) { String oldHttpProxyPassword = null; if (remoteProxySettingsConfiguration.getHttpProxySettings() != null && remoteProxySettingsConfiguration.getHttpProxySettings().getProxyAuthentication() != null) { oldHttpProxyPassword = ((UsernamePasswordRemoteAuthenticationSettings) remoteProxySettingsConfiguration.getHttpProxySettings() .getProxyAuthentication()).getPassword(); if (remoteProxySettingsConfiguration.getHttpsProxySettings() != null && remoteProxySettingsConfiguration.getHttpsProxySettings().getProxyAuthentication() != null) { oldHttpsProxyPassword = ((UsernamePasswordRemoteAuthenticationSettings) remoteProxySettingsConfiguration.getHttpsProxySettings() .getProxyAuthentication()).getPassword(); remoteProxySettingsConfiguration.setHttpProxySettings( convert(remoteProxySettings.getHttpProxySettings(), oldHttpProxyPassword) ); remoteProxySettingsConfiguration.setHttpsProxySettings( convert(remoteProxySettings.getHttpsProxySettings(), oldHttpsProxyPassword) ); remoteProxySettingsConfiguration.setNonProxyHosts(cleanNonProxyHosts); remoteProxySettingsConfiguration.setNonProxyHosts(null); remoteProxySettingsConfiguration.setHttpProxySettings(null); remoteProxySettingsConfiguration.setHttpsProxySettings(null); remoteProxySettingsConfiguration.setNonProxyHosts(null);
/** * Externalized Nexus object to DTO's conversion. */ public static RemoteProxySettingsDTO convert(GlobalRemoteProxySettings settings) { if (settings == null) { return null; } RemoteProxySettingsDTO result = new RemoteProxySettingsDTO(); result.setHttpProxySettings(convert(settings.getHttpProxySettings())); result.setHttpsProxySettings(convert(settings.getHttpsProxySettings())); result.setNonProxyHosts(new ArrayList<String>(settings.getNonProxyHosts())); return result; }
protected void inspect(final Event<?> evt) { // FIXME: Sort out what to do with http/https here RemoteHttpProxySettings httpProxySettings = globalRemoteProxySettings.getHttpProxySettings(); if (httpProxySettings != null && httpProxySettings.isEnabled()) { String username = null; String password = null; final RemoteAuthenticationSettings authentication = httpProxySettings.getProxyAuthentication(); if (authentication != null && UsernamePasswordRemoteAuthenticationSettings.class.isAssignableFrom(authentication.getClass())) { username = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getUsername(); password = ((UsernamePasswordRemoteAuthenticationSettings) authentication).getPassword(); } final String hostname = httpProxySettings.getHostname(); final int port = httpProxySettings.getPort(); final Set<String> nonProxyHosts = globalRemoteProxySettings.getNonProxyHosts(); log.debug( "Configure P2 proxy using global http proxy settings: hostname={}, port={}, username={}, nonProxyHosts={}", hostname, port, username, nonProxyHosts ); httpProxy.setProxySettings(hostname, port, username, password, nonProxyHosts); } else { log.debug("No global http proxy settings. Resetting P2 proxy."); httpProxy.setProxySettings(null, -1, null, null, null); } }