diff --git a/plugin-nifi/pom.xml b/plugin-nifi/pom.xml index 5e0cbdcea5..66700cb56b 100644 --- a/plugin-nifi/pom.xml +++ b/plugin-nifi/pom.xml @@ -28,6 +28,8 @@ NiFi Security Plugin NiFi Security Plugin + true + false UTF-8 diff --git a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/RangerServiceNiFi.java b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/RangerServiceNiFi.java index f9c9947b1a..206e577ea9 100644 --- a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/RangerServiceNiFi.java +++ b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/RangerServiceNiFi.java @@ -24,6 +24,7 @@ import org.apache.ranger.services.nifi.client.NiFiConnectionMgr; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import java.util.HashMap; import java.util.List; @@ -31,32 +32,27 @@ * RangerService for Apache NiFi. */ public class RangerServiceNiFi extends RangerBaseService { - private static final Logger LOG = LoggerFactory.getLogger(RangerServiceNiFi.class); @Override - public HashMap validateConfig() throws Exception { - HashMap ret = new HashMap<>(); - String serviceName = getServiceName(); + public HashMap validateConfig() { + HashMap ret = new HashMap<>(); + String serviceName = getServiceName(); - if (LOG.isDebugEnabled()) { - LOG.debug("==> RangerServiceNiFi.validateConfig Service: (" + serviceName + " )"); - } + LOG.debug("==> RangerServiceNiFi.validateConfig Service: ({})", serviceName); if (configs != null) { try { ret = NiFiConnectionMgr.connectionTest(serviceName, configs); } catch (Exception e) { - LOG.error("<== RangerServiceNiFi.validateConfig Error:", e); + LOG.error("<== RangerServiceNiFi.validateConfig Error: ", e); throw e; } } else { throw new IllegalStateException("No Configuration found"); } - if (LOG.isDebugEnabled()) { - LOG.debug("<== RangerServiceNiFi.validateConfig Response : (" + ret + " )"); - } + LOG.debug("<== RangerServiceNiFi.validateConfig Response : ({})", ret); return ret; } @@ -66,5 +62,4 @@ public List lookupResource(ResourceLookupContext context) throws Excepti final NiFiClient client = NiFiConnectionMgr.getNiFiClient(serviceName, configs); return client.getResources(context); } - } diff --git a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiAuthType.java b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiAuthType.java index 47267a416a..eeda9299d4 100644 --- a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiAuthType.java +++ b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiAuthType.java @@ -22,8 +22,6 @@ * Possible authentication types for NiFi. */ public enum NiFiAuthType { - NONE, SSL - } diff --git a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiClient.java b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiClient.java index 968674b10d..e97375d40b 100644 --- a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiClient.java +++ b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiClient.java @@ -18,6 +18,8 @@ */ package org.apache.ranger.services.nifi.client; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; @@ -28,8 +30,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.ranger.plugin.client.BaseClient; import org.apache.ranger.plugin.service.ResourceLookupContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,6 +38,7 @@ import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.ws.rs.core.Response; + import java.security.cert.Certificate; import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; @@ -50,64 +51,58 @@ * Client to communicate with NiFi and retrieve available resources. */ public class NiFiClient { - private static final Logger LOG = LoggerFactory.getLogger(NiFiClient.class); static final String SUCCESS_MSG = "ConnectionTest Successful"; static final String FAILURE_MSG = "Unable to retrieve any resources using given parameters. "; - private final String url; - private final SSLContext sslContext; + private final String url; + private final SSLContext sslContext; private final HostnameVerifier hostnameVerifier; - private final ObjectMapper mapper = new ObjectMapper(); + private final ObjectMapper mapper = new ObjectMapper(); public NiFiClient(final String url, final SSLContext sslContext) { - this.url = url; - this.sslContext = sslContext; + this.url = url; + this.sslContext = sslContext; this.hostnameVerifier = new NiFiHostnameVerifier(); } public HashMap connectionTest() { - String errMsg = ""; - boolean connectivityStatus; + String errMsg = ""; + boolean connectivityStatus; HashMap responseData = new HashMap<>(); try { - final WebResource resource = getWebResource(); + final WebResource resource = getWebResource(); final ClientResponse response = getResponse(resource, "application/json"); - if (LOG.isDebugEnabled()) { - LOG.debug("Got response from NiFi with status code " + response.getStatus()); - } + LOG.debug("Got response from NiFi with status code {}", response.getStatus()); if (Response.Status.OK.getStatusCode() == response.getStatus()) { connectivityStatus = true; } else { connectivityStatus = false; - errMsg = "Status Code = " + response.getStatus(); + errMsg = "Status Code = " + response.getStatus(); } - } catch (Exception e) { - LOG.error("Connection to NiFi failed due to " + e.getMessage(), e); + LOG.error("Connection to NiFi failed due to {}", e.getMessage(), e); connectivityStatus = false; - errMsg = e.getMessage(); + errMsg = e.getMessage(); } if (connectivityStatus) { - BaseClient.generateResponseDataMap(connectivityStatus, SUCCESS_MSG, SUCCESS_MSG, null, null, responseData); + BaseClient.generateResponseDataMap(true, SUCCESS_MSG, SUCCESS_MSG, null, null, responseData); } else { - BaseClient.generateResponseDataMap(connectivityStatus, FAILURE_MSG, FAILURE_MSG + errMsg, null, null, responseData); + BaseClient.generateResponseDataMap(false, FAILURE_MSG, FAILURE_MSG + errMsg, null, null, responseData); } - if (LOG.isDebugEnabled()) { - LOG.debug("Response Data - " + responseData); - } + LOG.debug("Response Data - {}", responseData); return responseData; } public List getResources(ResourceLookupContext context) throws Exception { - final WebResource resource = getWebResource(); + final WebResource resource = getWebResource(); final ClientResponse response = getResponse(resource, "application/json"); if (Response.Status.OK.getStatusCode() != response.getStatus()) { @@ -120,8 +115,8 @@ public List getResources(ResourceLookupContext context) throws Exception throw new Exception("Unable to retrieve resources from NiFi"); } - JsonNode resourcesNode = rootNode.findValue("resources"); - List identifiers = resourcesNode.findValuesAsText("identifier"); + JsonNode resourcesNode = rootNode.findValue("resources"); + List identifiers = resourcesNode.findValuesAsText("identifier"); final String userInput = context.getUserInput(); if (StringUtils.isBlank(userInput)) { @@ -139,6 +134,18 @@ public List getResources(ResourceLookupContext context) throws Exception } } + public String getUrl() { + return url; + } + + public SSLContext getSslContext() { + return sslContext; + } + + public HostnameVerifier getHostnameVerifier() { + return hostnameVerifier; + } + protected WebResource getWebResource() { final ClientConfig config = new DefaultClientConfig(); if (sslContext != null) { @@ -154,37 +161,24 @@ protected ClientResponse getResponse(WebResource resource, String accept) { return resource.accept(accept).get(ClientResponse.class); } - public String getUrl() { - return url; - } - - public SSLContext getSslContext() { - return sslContext; - } - - public HostnameVerifier getHostnameVerifier() { - return hostnameVerifier; - } - /** * Custom hostname verifier that checks subject alternative names against the hostname of the URI. */ private static class NiFiHostnameVerifier implements HostnameVerifier { - @Override public boolean verify(final String hostname, final SSLSession ssls) { try { for (final Certificate peerCertificate : ssls.getPeerCertificates()) { if (peerCertificate instanceof X509Certificate) { - final X509Certificate x509Cert = (X509Certificate) peerCertificate; - final List subjectAltNames = getSubjectAlternativeNames(x509Cert); + final X509Certificate x509Cert = (X509Certificate) peerCertificate; + final List subjectAltNames = getSubjectAlternativeNames(x509Cert); if (subjectAltNames.contains(hostname.toLowerCase())) { return true; } } } } catch (final SSLPeerUnverifiedException | CertificateParsingException ex) { - LOG.warn("Hostname Verification encountered exception verifying hostname due to: " + ex, ex); + LOG.warn("Hostname Verification encountered exception verifying hostname due to: {}", ex, ex); } return false; @@ -196,23 +190,20 @@ private List getSubjectAlternativeNames(final X509Certificate certificat return new ArrayList<>(); } - final List result = new ArrayList<>(); - for (final List generalName : altNames) { + final List result = new ArrayList<>(); + for (final List generalName : altNames) { /** * generalName has the name type as the first element a String or byte array for the second element. We return any general names that are String types. - * * We don't inspect the numeric name type because some certificates incorrectly put IPs and DNS names under the wrong name types. */ - if (generalName.size() > 1) { - final Object value = generalName.get(1); - if (value instanceof String) { - result.add(((String) value).toLowerCase()); - } - } - + if (generalName.size() > 1) { + final Object value = generalName.get(1); + if (value instanceof String) { + result.add(((String) value).toLowerCase()); + } + } } return result; } } - } diff --git a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConfigs.java b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConfigs.java index 744f1dd47f..8efc1a3585 100644 --- a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConfigs.java +++ b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConfigs.java @@ -22,18 +22,16 @@ * Config property names from the NiFi service definition. */ public interface NiFiConfigs { + String NIFI_URL = "nifi.url"; + String NIFI_AUTHENTICATION_TYPE = "nifi.authentication"; - String NIFI_URL = "nifi.url"; - String NIFI_AUTHENTICATION_TYPE = "nifi.authentication"; + String NIFI_SSL_KEYSTORE = "nifi.ssl.keystore"; + String NIFI_SSL_KEYSTORE_TYPE = "nifi.ssl.keystoreType"; + String NIFI_SSL_KEYSTORE_PASSWORD = "nifi.ssl.keystorePassword"; - String NIFI_SSL_KEYSTORE = "nifi.ssl.keystore"; - String NIFI_SSL_KEYSTORE_TYPE = "nifi.ssl.keystoreType"; - String NIFI_SSL_KEYSTORE_PASSWORD = "nifi.ssl.keystorePassword"; - - String NIFI_SSL_TRUSTSTORE = "nifi.ssl.truststore"; - String NIFI_SSL_TRUSTSTORE_TYPE = "nifi.ssl.truststoreType"; - String NIFI_SSL_TRUSTSTORE_PASSWORD = "nifi.ssl.truststorePassword"; + String NIFI_SSL_TRUSTSTORE = "nifi.ssl.truststore"; + String NIFI_SSL_TRUSTSTORE_TYPE = "nifi.ssl.truststoreType"; + String NIFI_SSL_TRUSTSTORE_PASSWORD = "nifi.ssl.truststorePassword"; String NIFI_SSL_USER_DEFAULT_CONTEXT = "nifi.ssl.use.default.context"; - } diff --git a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConnectionMgr.java b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConnectionMgr.java index 8a2577c63a..f81824d70a 100644 --- a/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConnectionMgr.java +++ b/plugin-nifi/src/main/java/org/apache/ranger/services/nifi/client/NiFiConnectionMgr.java @@ -18,7 +18,6 @@ */ package org.apache.ranger.services.nifi.client; - import org.apache.commons.lang.StringUtils; import org.apache.ranger.plugin.client.BaseClient; import org.slf4j.Logger; @@ -27,6 +26,7 @@ import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; + import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -46,14 +46,15 @@ * Creates a NiFiClient and provides method to test a connection to NiFi. */ public class NiFiConnectionMgr { - private static final Logger LOG = LoggerFactory.getLogger(NiFiConnectionMgr.class); - static final String INVALID_URL_MSG = "NiFi URL must be a valid URL of the form " + - "http(s)://(:)/nifi-api/resources"; + static final String INVALID_URL_MSG = "NiFi URL must be a valid URL of the form http(s)://(:)/nifi-api/resources"; + private NiFiConnectionMgr() { + // to block instantiation + } - static public NiFiClient getNiFiClient(String serviceName, Map configs) throws Exception { + public static NiFiClient getNiFiClient(String serviceName, Map configs) throws Exception { final String url = configs.get(NiFiConfigs.NIFI_URL); validateNotBlank(url, "NiFi URL is required for " + serviceName); validateUrl(url); @@ -62,28 +63,26 @@ static public NiFiClient getNiFiClient(String serviceName, Map c validateNotBlank(authTypeStr, "Authentication Type is required for " + serviceName); final NiFiAuthType authType = NiFiAuthType.valueOf(authTypeStr); - LOG.debug("NiFiAuthType is " + authType.name()); + LOG.debug("NiFiAuthType is {}", authType.name()); SSLContext sslContext = null; if (authType == NiFiAuthType.SSL) { - if (!url.startsWith("https")) { throw new IllegalArgumentException("Authentication Type of SSL requires an https URL"); } - final String keystore = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE); - final String keystoreType = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE_TYPE); - final String keystorePassword = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE_PASSWORD); + final String keystore = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE); + final String keystoreType = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE_TYPE); + final String keystorePassword = configs.get(NiFiConfigs.NIFI_SSL_KEYSTORE_PASSWORD); - final String truststore = configs.get(NiFiConfigs.NIFI_SSL_TRUSTSTORE); - final String truststoreType = configs.get(NiFiConfigs.NIFI_SSL_TRUSTSTORE_TYPE); + final String truststore = configs.get(NiFiConfigs.NIFI_SSL_TRUSTSTORE); + final String truststoreType = configs.get(NiFiConfigs.NIFI_SSL_TRUSTSTORE_TYPE); final String truststorePassword = configs.get(NiFiConfigs.NIFI_SSL_TRUSTSTORE_PASSWORD); final String useDefaultSSLContext = configs.get(NiFiConfigs.NIFI_SSL_USER_DEFAULT_CONTEXT); if (!StringUtils.isBlank(useDefaultSSLContext) && "true".equalsIgnoreCase(useDefaultSSLContext)) { - if (!StringUtils.isBlank(keystore) || !StringUtils.isBlank(keystoreType) || !StringUtils.isBlank(keystorePassword) || !StringUtils.isBlank(truststore) || !StringUtils.isBlank(truststoreType) || !StringUtils.isBlank(truststorePassword)) { throw new IllegalArgumentException("Keystore and Truststore configuration cannot be provided when using default SSL context"); @@ -91,7 +90,6 @@ static public NiFiClient getNiFiClient(String serviceName, Map c sslContext = SSLContext.getDefault(); } else { - validateNotBlank(keystore, "Keystore is required for " + serviceName + " with Authentication Type of SSL"); validateNotBlank(keystoreType, "Keystore Type is required for " + serviceName + " with Authentication Type of SSL"); validateNotBlank(keystorePassword, "Keystore Password is required for " + serviceName + " with Authentication Type of SSL"); @@ -116,12 +114,12 @@ static public NiFiClient getNiFiClient(String serviceName, Map c return new NiFiClient(url.trim(), sslContext); } - public static HashMap connectionTest(String serviceName, Map configs) throws Exception { + public static HashMap connectionTest(String serviceName, Map configs) { NiFiClient client; try { client = getNiFiClient(serviceName, configs); } catch (Exception e) { - final HashMap ret = new HashMap<>(); + final HashMap ret = new HashMap<>(); BaseClient.generateResponseDataMap(false, "Error creating NiFi client", e.getMessage(), null, null, ret); return ret; } @@ -142,21 +140,17 @@ private static void validateUrl(String url) { if (!nifiUri.getPath().endsWith("nifi-api/resources")) { throw new IllegalArgumentException(INVALID_URL_MSG); } - } catch (URISyntaxException urie) { + } catch (URISyntaxException uriE) { throw new IllegalArgumentException(INVALID_URL_MSG); } } - private static SSLContext createSslContext( - final String keystore, final char[] keystorePasswd, final String keystoreType, - final String truststore, final char[] truststorePasswd, final String truststoreType, - final String protocol) + private static SSLContext createSslContext(final String keystore, final char[] keystorePasswd, final String keystoreType, final String truststore, final char[] truststorePasswd, final String truststoreType, final String protocol) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException, KeyManagementException { - // prepare the keystore final KeyStore keyStore = KeyStore.getInstance(keystoreType); - try (final InputStream keyStoreStream = new FileInputStream(keystore)) { + try (InputStream keyStoreStream = new FileInputStream(keystore)) { keyStore.load(keyStoreStream, keystorePasswd); } final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); @@ -164,7 +158,7 @@ private static SSLContext createSslContext( // prepare the truststore final KeyStore trustStore = KeyStore.getInstance(truststoreType); - try (final InputStream trustStoreStream = new FileInputStream(truststore)) { + try (InputStream trustStoreStream = new FileInputStream(truststore)) { trustStore.load(trustStoreStream, truststorePasswd); } final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); @@ -175,5 +169,4 @@ private static SSLContext createSslContext( sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); return sslContext; } - } diff --git a/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiClient.java b/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiClient.java index 051c940256..684c9ab8ce 100644 --- a/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiClient.java +++ b/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiClient.java @@ -27,6 +27,7 @@ import org.mockito.Mockito; import javax.ws.rs.core.Response; + import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -36,7 +37,6 @@ import static org.mockito.Mockito.when; public class TestNiFiClient { - private static final String RESOURCES_RESPONSE = "{\n" + " \"revision\": {\n" + " \"clientId\": \"0daac173-025c-4aa7-b644-97f7b10435d2\"\n" + @@ -131,7 +131,7 @@ public void testGetResourcesWithUserInputAnywhere() throws Exception { } @Test - public void testGetResourcesErrorResponse() throws Exception { + public void testGetResourcesErrorResponse() { final String errorMsg = "unknown error"; niFiClient = new MockNiFiClient(errorMsg, Response.Status.BAD_REQUEST.getStatusCode()); @@ -163,18 +163,16 @@ public void testConnectionTestFailure() { Assert.assertEquals(NiFiClient.FAILURE_MSG, ret.get("message")); } - /** * Extend NiFiClient to return mock responses. */ private static final class MockNiFiClient extends NiFiClient { - - private int statusCode; - private String responseEntity; + private final int statusCode; + private final String responseEntity; public MockNiFiClient(String responseEntity, int statusCode) { super("http://localhost:8080/nifi-api/resources", null); - this.statusCode = statusCode; + this.statusCode = statusCode; this.responseEntity = responseEntity; } @@ -187,9 +185,7 @@ protected WebResource getWebResource() { protected ClientResponse getResponse(WebResource resource, String accept) { ClientResponse response = Mockito.mock(ClientResponse.class); when(response.getStatus()).thenReturn(statusCode); - when(response.getEntityInputStream()).thenReturn(new ByteArrayInputStream( - responseEntity.getBytes(StandardCharsets.UTF_8) - )); + when(response.getEntityInputStream()).thenReturn(new ByteArrayInputStream(responseEntity.getBytes(StandardCharsets.UTF_8))); return response; } } diff --git a/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiConnectionMgr.java b/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiConnectionMgr.java index 1726854d06..925c9c3cac 100644 --- a/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiConnectionMgr.java +++ b/plugin-nifi/src/test/java/org/apache/ranger/services/nifi/client/TestNiFiConnectionMgr.java @@ -26,23 +26,22 @@ import java.util.Map; public class TestNiFiConnectionMgr { - - @Test (expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testValidURLWithWrongEndPoint() throws Exception { final String nifiUrl = "http://localhost:8080/nifi"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.NONE.name()); NiFiConnectionMgr.getNiFiClient("nifi", configs); } - @Test (expected = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testInvalidURL() throws Exception { final String nifiUrl = "not a url"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.NONE.name()); @@ -53,7 +52,7 @@ public void testInvalidURL() throws Exception { public void testAuthTypeNone() throws Exception { final String nifiUrl = "http://localhost:8080/nifi-api/resources"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.NONE.name()); @@ -65,7 +64,7 @@ public void testAuthTypeNone() throws Exception { @Test(expected = IllegalArgumentException.class) public void testAuthTypeNoneMissingURL() throws Exception { - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, null); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.NONE.name()); @@ -76,7 +75,7 @@ public void testAuthTypeNoneMissingURL() throws Exception { public void testAuthTypeSSL() throws Exception { final String nifiUrl = "https://localhost:8080/nifi-api/resources"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.SSL.name()); @@ -95,7 +94,7 @@ public void testAuthTypeSSL() throws Exception { public void testAuthTypeSSLWithNonHttpsUrl() throws Exception { final String nifiUrl = "http://localhost:8080/nifi-api/resources"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.SSL.name()); @@ -114,11 +113,10 @@ public void testAuthTypeSSLWithNonHttpsUrl() throws Exception { public void testAuthTypeSSLMissingConfigs() throws Exception { final String nifiUrl = "http://localhost:8080/nifi"; - Map configs = new HashMap<>(); + Map configs = new HashMap<>(); configs.put(NiFiConfigs.NIFI_URL, nifiUrl); configs.put(NiFiConfigs.NIFI_AUTHENTICATION_TYPE, NiFiAuthType.SSL.name()); NiFiConnectionMgr.getNiFiClient("nifi", configs); } - }