You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2022/04/19 16:25:16 UTC
[nifi] 04/09: NIFI-9928 Removed nifi-security-utils from nifi-prometheus-reporting-task
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.16
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 5588f32bb705ffa07c755d85428c74584053553d
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Thu Apr 14 17:10:03 2022 -0500
NIFI-9928 Removed nifi-security-utils from nifi-prometheus-reporting-task
- Adjusted PrometheusServer configuration to use SSLContextService.createContext() instead of individual properties
This closes #5970
Signed-off-by: Paul Grey <gr...@apache.org>
---
.../nifi-prometheus-reporting-task/pom.xml | 11 +++--------
.../nifi/reporting/prometheus/PrometheusServer.java | 17 ++++-------------
2 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
index eabec46a8e..0169af6636 100644
--- a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
+++ b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
@@ -48,14 +48,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-security-utils</artifactId>
- <version>1.16.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-ssl-context-service-api</artifactId>
- <version>1.16.1-SNAPSHOT</version>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-ssl-context-service-api</artifactId>
+ <version>1.17.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
diff --git a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
index cd815f59f5..6af7bec28a 100644
--- a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
+++ b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
@@ -33,6 +33,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.ssl.SslContextFactory;
+import javax.net.ssl.SSLContext;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
@@ -123,23 +124,13 @@ public class PrometheusServer {
}
private SslContextFactory createSslFactory(final SSLContextService sslService, boolean needClientAuth, boolean wantClientAuth) {
- SslContextFactory sslFactory = new SslContextFactory.Server();
+ final SslContextFactory.Server sslFactory = new SslContextFactory.Server();
sslFactory.setNeedClientAuth(needClientAuth);
sslFactory.setWantClientAuth(wantClientAuth);
- sslFactory.setProtocol(sslService.getSslAlgorithm());
- if (sslService.isKeyStoreConfigured()) {
- sslFactory.setKeyStorePath(sslService.getKeyStoreFile());
- sslFactory.setKeyStorePassword(sslService.getKeyStorePassword());
- sslFactory.setKeyStoreType(sslService.getKeyStoreType());
- }
-
- if (sslService.isTrustStoreConfigured()) {
- sslFactory.setTrustStorePath(sslService.getTrustStoreFile());
- sslFactory.setTrustStorePassword(sslService.getTrustStorePassword());
- sslFactory.setTrustStoreType(sslService.getTrustStoreType());
- }
+ final SSLContext sslContext = sslService.createContext();
+ sslFactory.setSslContext(sslContext);
return sslFactory;
}