|
22 | 22 |
|
23 | 23 | import eu.openanalytics.containerproxy.auth.UserLogoutHandler; |
24 | 24 | import eu.openanalytics.containerproxy.auth.impl.SAMLAuthenticationBackend; |
| 25 | +import org.apache.commons.httpclient.HostConfiguration; |
25 | 26 | import org.apache.commons.httpclient.HttpClient; |
26 | 27 | import org.apache.logging.log4j.LogManager; |
27 | 28 | import org.apache.logging.log4j.Logger; |
@@ -261,17 +262,29 @@ public ExtendedMetadata extendedMetadata() { |
261 | 262 | } |
262 | 263 |
|
263 | 264 | @Bean |
264 | | - public ExtendedMetadataDelegate idpMetadata() throws MetadataProviderException, ResourceException { |
| 265 | + public ExtendedMetadataDelegate idpMetadata() throws MetadataProviderException { |
265 | 266 | String metadataURL = environment.getProperty(PROP_METADATA_URL); |
266 | 267 |
|
267 | 268 | Timer backgroundTaskTimer = new Timer(true); |
268 | | - HTTPMetadataProvider httpMetadataProvider = new HTTPMetadataProvider(backgroundTaskTimer, new HttpClient(), metadataURL); httpMetadataProvider.setParserPool(parserPool()); |
| 269 | + HTTPMetadataProvider httpMetadataProvider = new HTTPMetadataProvider(backgroundTaskTimer, getHttpClient(), metadataURL); |
| 270 | + httpMetadataProvider.setParserPool(parserPool()); |
269 | 271 | ExtendedMetadataDelegate extendedMetadataDelegate = new ExtendedMetadataDelegate(httpMetadataProvider , extendedMetadata()); |
270 | 272 | extendedMetadataDelegate.setMetadataTrustCheck(false); |
271 | 273 | extendedMetadataDelegate.setMetadataRequireSignature(false); |
272 | 274 | return extendedMetadataDelegate; |
273 | 275 | } |
274 | 276 |
|
| 277 | + private HttpClient getHttpClient() { |
| 278 | + HttpClient httpClient = new HttpClient(); |
| 279 | + String proxyHost = System.getProperty("http.proxyHost"); |
| 280 | + if (proxyHost != null) { |
| 281 | + HostConfiguration hostConfiguration = new HostConfiguration(); |
| 282 | + hostConfiguration.setProxy(proxyHost, Integer.parseInt(System.getProperty("http.proxyPort","80"))); |
| 283 | + httpClient.setHostConfiguration(hostConfiguration); |
| 284 | + } |
| 285 | + return httpClient; |
| 286 | + } |
| 287 | + |
275 | 288 | @Bean |
276 | 289 | @Qualifier("metadata") |
277 | 290 | public CachingMetadataManager metadata() throws MetadataProviderException, ResourceException { |
|
0 commit comments