use of org.apache.cxf.configuration.security.ProxyAuthorizationPolicy in project maven-plugins by apache.
the class RestJiraDownloader method setupWebClient.
private WebClient setupWebClient(String jiraUrl) {
WebClient client = WebClient.create(jiraUrl);
ClientConfiguration clientConfiguration = WebClient.getConfig(client);
HTTPConduit http = clientConfiguration.getHttpConduit();
// MCHANGES-324 - Maintain the client session
clientConfiguration.getRequestContext().put(Message.MAINTAIN_SESSION, Boolean.TRUE);
if (getLog().isDebugEnabled()) {
clientConfiguration.getInInterceptors().add(new LoggingInInterceptor());
clientConfiguration.getOutInterceptors().add(new LoggingOutInterceptor());
}
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
// MCHANGES-341 Externalize JIRA server timeout values to the configuration section
getLog().debug("RestJiraDownloader: connectionTimeout: " + connectionTimeout);
httpClientPolicy.setConnectionTimeout(connectionTimeout);
httpClientPolicy.setAllowChunking(false);
getLog().debug("RestJiraDownloader: receiveTimout: " + receiveTimout);
httpClientPolicy.setReceiveTimeout(receiveTimout);
// MCHANGES-334 RestJiraDownloader doesn't honor proxy settings
getProxyInfo(jiraUrl);
if (proxyHost != null) {
getLog().debug("Using proxy: " + proxyHost + " at port " + proxyPort);
httpClientPolicy.setProxyServer(proxyHost);
httpClientPolicy.setProxyServerPort(proxyPort);
httpClientPolicy.setProxyServerType(ProxyServerType.HTTP);
if (proxyUser != null) {
ProxyAuthorizationPolicy proxyAuthorizationPolicy = new ProxyAuthorizationPolicy();
proxyAuthorizationPolicy.setAuthorizationType("Basic");
proxyAuthorizationPolicy.setUserName(proxyUser);
proxyAuthorizationPolicy.setPassword(proxyPass);
http.setProxyAuthorization(proxyAuthorizationPolicy);
}
}
if (webUser != null) {
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setAuthorizationType("Basic");
authPolicy.setUserName(webUser);
authPolicy.setPassword(webPassword);
http.setAuthorization(authPolicy);
}
http.setClient(httpClientPolicy);
return client;
}
Aggregations