Skip to content

Commit

Permalink
Merge pull request #56 from nordic-institute/XRDCAT-28-fixes
Browse files Browse the repository at this point in the history
fix: Fix shared-param-file default value in configurations, and fix deprecated code

Refs: XRDCAT-28
  • Loading branch information
melbeltagy authored Sep 23, 2024
2 parents 671b2a0 + 97aa803 commit 19ba6a3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docker/lister/config/application-fi.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ springdoc:

# X-Road instance parameters
xroad-catalog:
shared-params-file: /etc/xroad/globalconf/DEV/shared-params.xml
shared-params-file: ${xroad.common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml
country:
fi:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion docker/lister/config/application-production.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ springdoc:

# X-Road instance parameters
xroad-catalog:
shared-params-file: /etc/xroad/globalconf/DEV/shared-params.xml
shared-params-file: ${xroad.common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml
country:
fi:
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion docker/lister/config/application.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xroad:

# X-Road instance parameters
xroad-catalog:
shared-params-file: ${common.configuration-path}/DEV/shared-params.xml
shared-params-file: ${xroad.common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml
country.fi.enabled: true
configuration-client.enabled: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
import org.json.JSONArray;
Expand Down Expand Up @@ -610,18 +610,16 @@ public boolean isTrusted(X509Certificate[] x509Certificates, String s)
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy)
.build();
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext,
new NoopHostnameVerifier());
DefaultClientTlsStrategy defaultClientTlsStrategy = new DefaultClientTlsStrategy(sslContext, new NoopHostnameVerifier());
PoolingHttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder
.create()
.setSSLSocketFactory(csf)
.setTlsSocketStrategy(defaultClientTlsStrategy)
.build();
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
RestTemplate restTemplate = new RestTemplate(requestFactory);

return restTemplate;
return new RestTemplate(requestFactory);
} catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
log.error("Error creating REST client for Company and Organization services", e);
return null;
Expand Down
6 changes: 3 additions & 3 deletions xroad-catalog-lister/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Configurations are categorized according to their usage into different groups in

#### Mandatory Configurations for Common Features

| Parameter | Defaults | Description | Since |
|------------------------------------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------|-------|
| `xroad-catalog.shared-params-file` | ${common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml | A parameter for setting the path to shared params file exported from X-Road server. | 1.0.0 |
| Parameter | Defaults | Description | Since |
|------------------------------------|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------|-------|
| `xroad-catalog.shared-params-file` | ${xroad.common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml | A parameter for setting the path to shared params file exported from X-Road server. | 1.0.0 |

### Optional Configurations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:

# X-Road instance parameters
xroad-catalog:
shared-params-file: ${xroad.conf.path}globalconf/DEV/shared-params.xml
shared-params-file: ${xroad.common.configuration-path}/DEV/shared-params.xml
country:
fi:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion xroad-catalog-lister/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xroad:

# X-Road instance parameters
xroad-catalog:
shared-params-file: ${common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml
shared-params-file: ${xroad.common.configuration-path}/<INSTANCE_IDENTIFIER>/shared-params.xml
country.fi.enabled: false
configuration-client.enabled: true

Expand Down

0 comments on commit 19ba6a3

Please sign in to comment.