use of com.blackducksoftware.integration.hub.proxy.ProxyInfoBuilder in project hub-detect by blackducksoftware.
the class DetectConfiguration method getHubProxyInfo.
public ProxyInfo getHubProxyInfo() throws DetectUserFriendlyException {
final ProxyInfoBuilder proxyInfoBuilder = new ProxyInfoBuilder();
proxyInfoBuilder.setHost(hubProxyHost);
proxyInfoBuilder.setPort(hubProxyPort);
proxyInfoBuilder.setUsername(hubProxyUsername);
proxyInfoBuilder.setPassword(hubProxyPassword);
proxyInfoBuilder.setNtlmDomain(hubProxyNtlmDomain);
proxyInfoBuilder.setNtlmWorkstation(hubProxyNtlmWorkstation);
ProxyInfo proxyInfo = ProxyInfo.NO_PROXY_INFO;
try {
proxyInfo = proxyInfoBuilder.build();
} catch (final IllegalStateException e) {
throw new DetectUserFriendlyException(String.format("Your proxy configuration is not valid: %s", e.getMessage()), e, ExitCodeType.FAILURE_PROXY_CONNECTIVITY);
}
return proxyInfo;
}
use of com.blackducksoftware.integration.hub.proxy.ProxyInfoBuilder in project hub-fortify-ssc-integration-service by blackducksoftware.
the class RestConnectionHelper method getProxyInfo.
/**
* Return the proxy info based on the configuration
*
* @param serverConfig
* @return
* @throws EncryptionException
* @throws IllegalArgumentException
*/
private static ProxyInfo getProxyInfo(final HubServerConfig serverConfig) throws EncryptionException, IllegalArgumentException {
if (!StringUtils.isEmpty(serverConfig.getProxyInfo().getHost())) {
final ProxyInfoBuilder proxyInfoBuilder = new ProxyInfoBuilder();
proxyInfoBuilder.setHost(serverConfig.getProxyInfo().getHost());
proxyInfoBuilder.setPort(serverConfig.getProxyInfo().getPort());
proxyInfoBuilder.setUsername(serverConfig.getProxyInfo().getUsername());
proxyInfoBuilder.setPassword(serverConfig.getProxyInfo().getDecryptedPassword());
proxyInfoBuilder.setNtlmDomain(serverConfig.getProxyInfo().getNtlmDomain());
proxyInfoBuilder.setNtlmWorkstation(serverConfig.getProxyInfo().getNtlmWorkstation());
proxyInfoBuilder.setIgnoredProxyHosts(serverConfig.getProxyInfo().getIgnoredProxyHosts());
return proxyInfoBuilder.build();
} else {
return new ProxyInfo(null, 0, null, null, null, null);
}
}
Aggregations