aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2022-05-13 09:01:26 +0200
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2022-07-06 06:09:50 +0200
commit5da97dc829f00e8549ccf5617b434aa911578d8b (patch)
treefb0a293b051a7f2e46ea736356cd6edf98a9371d /datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
parent7fdc015b330cf36d4a272af7e9ce31f60248bfd6 (diff)
Make TLS connection optional1.8.0
Issue-ID: DCAEGEN2-3039 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: Id637ba17c655407009a4f40f6c93f518b99e45ff
Diffstat (limited to 'datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java')
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
index 70380437..0df57a2c 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START======================================================================
* Copyright (C) 2018-2019 Nordix Foundation. All rights reserved.
- * Copyright (C) 2020-2021 Nokia. All rights reserved.
+ * Copyright (C) 2020-2022 Nokia. All rights reserved.
* ===============================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@@ -175,8 +175,11 @@ public class FileCollector {
new SftpClientSettings(datafileAppConfig.getSftpConfiguration()));
}
- protected FtpesClient createFtpesClient(FileData fileData) {
+ protected FtpesClient createFtpesClient(FileData fileData) throws DatafileTaskException {
CertificateConfig config = datafileAppConfig.getCertificateConfiguration();
+ if (!config.enableCertAuth()) {
+ throw new DatafileTaskException("FTPES error: TLS connection is disabled");
+ }
return new FtpesClient(fileData.fileServerData(), Paths.get(config.keyCert()), config.keyPasswordPath(),
Paths.get(config.trustedCa()), config.trustedCaPasswordPath());
}
@@ -186,6 +189,9 @@ public class FileCollector {
}
protected FileCollectClient createHttpsClient(FileData fileData) throws DatafileTaskException {
+ if (!datafileAppConfig.getCertificateConfiguration().enableCertAuth()) {
+ throw new DatafileTaskException("HTTPS error: TLS connection is disabled");
+ }
return new DfcHttpsClient(fileData.fileServerData(), HttpsClientConnectionManagerUtil.instance());
}
}