mirror of https://github.com/apache/nifi.git
NIFI-8096 Deprecated ClientAuth references in SSLContextService
- Added SSLContextService.createContext() and refactored referencing components - Removed references to ClientAuth from SslContextFactory methods This closes #4737. Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
parent
783633cac5
commit
817f621d6f
|
@ -31,7 +31,6 @@ import javax.net.ssl.SSLContext;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import okhttp3.mockwebserver.MockWebServer;
|
import okhttp3.mockwebserver.MockWebServer;
|
||||||
import org.apache.nifi.bootstrap.NotificationServiceManager;
|
import org.apache.nifi.bootstrap.NotificationServiceManager;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -138,7 +137,7 @@ public class TestHttpNotificationServiceSSL extends TestHttpNotificationServiceC
|
||||||
|
|
||||||
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration("./src/test/resources/keystore.jks", "passwordpassword", null, "JKS",
|
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration("./src/test/resources/keystore.jks", "passwordpassword", null, "JKS",
|
||||||
"./src/test/resources/truststore.jks", "passwordpassword", "JKS", TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
"./src/test/resources/truststore.jks", "passwordpassword", "JKS", TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
||||||
final SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
final SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
mockWebServer.useHttps(sslContext.getSocketFactory(), false);
|
mockWebServer.useHttps(sslContext.getSocketFactory(), false);
|
||||||
|
|
||||||
String configFileOutput = CONFIGURATION_FILE_TEXT.replace("${test.server}", String.valueOf(mockWebServer.url("/")));
|
String configFileOutput = CONFIGURATION_FILE_TEXT.replace("${test.server}", String.valueOf(mockWebServer.url("/")));
|
||||||
|
|
|
@ -43,27 +43,13 @@ public final class SslContextFactory {
|
||||||
// TODO: Move to nifi-security-utils-core
|
// TODO: Move to nifi-security-utils-core
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the provided TLS configuration. Hardcodes the
|
* Create and initialize a {@link SSLContext} from the provided TLS configuration.
|
||||||
* client auth setting to {@link ClientAuth#REQUIRED} because this method is usually used when
|
|
||||||
* creating a context for a client, which ignores the setting anyway.
|
|
||||||
*
|
*
|
||||||
* @param tlsConfiguration the TLS configuration container object
|
* @param tlsConfiguration the TLS configuration container object
|
||||||
* @return the configured SSLContext
|
* @return {@link SSLContext} initialized from TLS Configuration or null when TLS Configuration is empty
|
||||||
* @throws TlsException if there is a problem configuring the SSLContext
|
* @throws TlsException if there is a problem configuring the SSLContext
|
||||||
*/
|
*/
|
||||||
public static SSLContext createSslContext(TlsConfiguration tlsConfiguration) throws TlsException {
|
public static SSLContext createSslContext(final TlsConfiguration tlsConfiguration) throws TlsException {
|
||||||
return createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a configured {@link SSLContext} from the provided TLS configuration.
|
|
||||||
*
|
|
||||||
* @param tlsConfiguration the TLS configuration container object
|
|
||||||
* @param clientAuth the {@link ClientAuth} setting
|
|
||||||
* @return the configured SSLContext
|
|
||||||
* @throws TlsException if there is a problem configuring the SSLContext
|
|
||||||
*/
|
|
||||||
public static SSLContext createSslContext(TlsConfiguration tlsConfiguration, ClientAuth clientAuth) throws TlsException {
|
|
||||||
if (TlsConfiguration.isEmpty(tlsConfiguration)) {
|
if (TlsConfiguration.isEmpty(tlsConfiguration)) {
|
||||||
logger.debug("Cannot create SSLContext from empty TLS configuration; returning null");
|
logger.debug("Cannot create SSLContext from empty TLS configuration; returning null");
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,31 +65,25 @@ public final class SslContextFactory {
|
||||||
}
|
}
|
||||||
final TrustManager[] trustManagers = getTrustManagers(tlsConfiguration);
|
final TrustManager[] trustManagers = getTrustManagers(tlsConfiguration);
|
||||||
|
|
||||||
return createSslContext(tlsConfiguration, trustManagers, clientAuth);
|
return createSslContext(tlsConfiguration, trustManagers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the provided TLS configuration and Trust Managers
|
* Create and initialize a {@link SSLContext} from the provided TLS configuration and Trust Managers.
|
||||||
*
|
*
|
||||||
* @param tlsConfiguration the TLS configuration container object
|
* @param tlsConfiguration the TLS configuration container object
|
||||||
* @param trustManagers Trust Managers can be null to use platform default Trust Managers
|
* @param trustManagers Trust Managers can be null to use platform default Trust Managers
|
||||||
* @param clientAuth the {@link ClientAuth} setting
|
* @return {@link SSLContext} initialized from TLS Configuration or null when TLS Configuration is empty
|
||||||
* @return the configured SSLContext
|
|
||||||
* @throws TlsException if there is a problem configuring the SSLContext
|
* @throws TlsException if there is a problem configuring the SSLContext
|
||||||
*/
|
*/
|
||||||
public static SSLContext createSslContext(final TlsConfiguration tlsConfiguration, final TrustManager[] trustManagers, ClientAuth clientAuth) throws TlsException {
|
public static SSLContext createSslContext(final TlsConfiguration tlsConfiguration, final TrustManager[] trustManagers) throws TlsException {
|
||||||
if (TlsConfiguration.isEmpty(tlsConfiguration)) {
|
if (TlsConfiguration.isEmpty(tlsConfiguration)) {
|
||||||
logger.debug("Cannot create SSLContext from empty TLS configuration; returning null");
|
logger.debug("Cannot create SSLContext from empty TLS configuration; returning null");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientAuth == null) {
|
|
||||||
clientAuth = ClientAuth.REQUIRED;
|
|
||||||
logger.debug("ClientAuth was null so defaulting to {}", clientAuth);
|
|
||||||
}
|
|
||||||
|
|
||||||
final KeyManager[] keyManagers = getKeyManagers(tlsConfiguration);
|
final KeyManager[] keyManagers = getKeyManagers(tlsConfiguration);
|
||||||
return initializeSSLContext(tlsConfiguration, clientAuth, keyManagers, trustManagers);
|
return initializeSSLContext(tlsConfiguration, keyManagers, trustManagers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,15 +111,13 @@ public final class SslContextFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to return the {@link SSLSocketFactory} from the created {@link SSLContext}
|
* Convenience method to return the {@link SSLSocketFactory} from the created {@link SSLContext}
|
||||||
* because that is what most callers of {@link #createSslContext(TlsConfiguration, ClientAuth)}
|
|
||||||
* actually need and don't know what to provide for the {@link ClientAuth} parameter.
|
|
||||||
*
|
*
|
||||||
* @param tlsConfiguration the TLS configuration container object
|
* @param tlsConfiguration the TLS configuration container object
|
||||||
* @return the configured SSLSocketFactory (can be {@code null})
|
* @return the configured SSLSocketFactory (can be {@code null})
|
||||||
* @throws TlsException if there is a problem creating the SSLContext or SSLSocketFactory
|
* @throws TlsException if there is a problem creating the SSLContext or SSLSocketFactory
|
||||||
*/
|
*/
|
||||||
public static SSLSocketFactory createSSLSocketFactory(TlsConfiguration tlsConfiguration) throws TlsException {
|
public static SSLSocketFactory createSSLSocketFactory(final TlsConfiguration tlsConfiguration) throws TlsException {
|
||||||
SSLContext sslContext = createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
SSLContext sslContext = createSslContext(tlsConfiguration);
|
||||||
if (sslContext == null) {
|
if (sslContext == null) {
|
||||||
// Only display an error in the log if the provided config wasn't empty
|
// Only display an error in the log if the provided config wasn't empty
|
||||||
if (!TlsConfiguration.isEmpty(tlsConfiguration)) {
|
if (!TlsConfiguration.isEmpty(tlsConfiguration)) {
|
||||||
|
@ -209,25 +187,12 @@ public final class SslContextFactory {
|
||||||
return trustManagers;
|
return trustManagers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SSLContext initializeSSLContext(TlsConfiguration tlsConfiguration, ClientAuth clientAuth, KeyManager[] keyManagers, TrustManager[] trustManagers) throws TlsException {
|
private static SSLContext initializeSSLContext(final TlsConfiguration tlsConfiguration, final KeyManager[] keyManagers, final TrustManager[] trustManagers) throws TlsException {
|
||||||
final SSLContext sslContext;
|
|
||||||
try {
|
try {
|
||||||
sslContext = SSLContext.getInstance(tlsConfiguration.getProtocol());
|
final SSLContext sslContext = SSLContext.getInstance(tlsConfiguration.getProtocol());
|
||||||
sslContext.init(keyManagers, trustManagers, new SecureRandom());
|
sslContext.init(keyManagers, trustManagers, new SecureRandom());
|
||||||
switch (clientAuth) {
|
|
||||||
case REQUIRED:
|
|
||||||
sslContext.getDefaultSSLParameters().setNeedClientAuth(true);
|
|
||||||
break;
|
|
||||||
case WANT:
|
|
||||||
sslContext.getDefaultSSLParameters().setWantClientAuth(true);
|
|
||||||
break;
|
|
||||||
case NONE:
|
|
||||||
default:
|
|
||||||
sslContext.getDefaultSSLParameters().setWantClientAuth(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sslContext;
|
return sslContext;
|
||||||
} catch (NoSuchAlgorithmException | KeyManagementException e) {
|
} catch (final NoSuchAlgorithmException | KeyManagementException e) {
|
||||||
logger.error("Encountered an error creating SSLContext from TLS configuration ({}): {}", tlsConfiguration.toString(), e.getLocalizedMessage());
|
logger.error("Encountered an error creating SSLContext from TLS configuration ({}): {}", tlsConfiguration.toString(), e.getLocalizedMessage());
|
||||||
throw new TlsException("Error creating SSL context", e);
|
throw new TlsException("Error creating SSL context", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,18 +99,12 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert sslContext.protocol == tlsConfiguration.protocol
|
assert sslContext.protocol == tlsConfiguration.protocol
|
||||||
|
|
||||||
def defaultSSLParameters = sslContext.defaultSSLParameters
|
|
||||||
logger.info("Default SSL Parameters: ${KeyStoreUtils.sslParametersToString(defaultSSLParameters)}" as String)
|
|
||||||
assertProtocolVersions(defaultSSLParameters.protocols, TlsPlatform.supportedProtocols)
|
|
||||||
assert !defaultSSLParameters.needClientAuth
|
|
||||||
assert !defaultSSLParameters.wantClientAuth
|
|
||||||
|
|
||||||
// Check a socket created from this context
|
// Check a socket created from this context
|
||||||
assertSocketProtocols(sslContext)
|
assertSocketProtocols(sslContext)
|
||||||
}
|
}
|
||||||
|
@ -129,18 +123,12 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${configWithoutKeyPassword}")
|
logger.info("Creating SSL Context from TLS Configuration: ${configWithoutKeyPassword}")
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(configWithoutKeyPassword, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(configWithoutKeyPassword)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert sslContext.protocol == configWithoutKeyPassword.protocol
|
assert sslContext.protocol == configWithoutKeyPassword.protocol
|
||||||
|
|
||||||
def defaultSSLParameters = sslContext.defaultSSLParameters
|
|
||||||
logger.info("Default SSL Parameters: ${KeyStoreUtils.sslParametersToString(defaultSSLParameters)}" as String)
|
|
||||||
assertProtocolVersions(defaultSSLParameters.protocols, TlsPlatform.supportedProtocols)
|
|
||||||
assert !defaultSSLParameters.needClientAuth
|
|
||||||
assert !defaultSSLParameters.wantClientAuth
|
|
||||||
|
|
||||||
// Check a socket created from this context
|
// Check a socket created from this context
|
||||||
assertSocketProtocols(sslContext)
|
assertSocketProtocols(sslContext)
|
||||||
}
|
}
|
||||||
|
@ -175,12 +163,12 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
def noKeystorePathMsg = shouldFail(TlsException) {
|
def noKeystorePathMsg = shouldFail(TlsException) {
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(configNoKeystorePath, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(configNoKeystorePath)
|
||||||
logger.info("Created SSL Context missing keystore path: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context missing keystore path: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
def noTruststorePathMsg = shouldFail(TlsException) {
|
def noTruststorePathMsg = shouldFail(TlsException) {
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(configNoTruststorePath, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(configNoTruststorePath)
|
||||||
logger.info("Created SSL Context missing truststore path: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context missing truststore path: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,18 +194,12 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${configNoTruststorePassword}")
|
logger.info("Creating SSL Context from TLS Configuration: ${configNoTruststorePassword}")
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(configNoTruststorePassword, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(configNoTruststorePassword)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert sslContext.protocol == configNoTruststorePassword.protocol
|
assert sslContext.protocol == configNoTruststorePassword.protocol
|
||||||
|
|
||||||
def defaultSSLParameters = sslContext.defaultSSLParameters
|
|
||||||
logger.info("Default SSL Parameters: ${KeyStoreUtils.sslParametersToString(defaultSSLParameters)}" as String)
|
|
||||||
assertProtocolVersions(defaultSSLParameters.protocols, TlsPlatform.supportedProtocols)
|
|
||||||
assert !defaultSSLParameters.needClientAuth
|
|
||||||
assert !defaultSSLParameters.wantClientAuth
|
|
||||||
|
|
||||||
// Check a socket created from this context
|
// Check a socket created from this context
|
||||||
assertSocketProtocols(sslContext)
|
assertSocketProtocols(sslContext)
|
||||||
}
|
}
|
||||||
|
@ -239,7 +221,7 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
def msg = shouldFail(TlsException) {
|
def msg = shouldFail(TlsException) {
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(keystoreOnlyConfig, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(keystoreOnlyConfig)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
}
|
}
|
||||||
logger.expected(msg)
|
logger.expected(msg)
|
||||||
|
@ -259,7 +241,7 @@ class SslContextFactoryTest extends GroovyTestCase {
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${emptyConfig}")
|
logger.info("Creating SSL Context from TLS Configuration: ${emptyConfig}")
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(emptyConfig, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(emptyConfig)
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert !sslContext
|
assert !sslContext
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.apache.nifi.io.socket;
|
package org.apache.nifi.io.socket;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsException;
|
import org.apache.nifi.security.util.TlsException;
|
||||||
|
@ -34,8 +33,7 @@ public final class ServerSocketConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSLContext createSSLContext() throws TlsException {
|
public SSLContext createSSLContext() throws TlsException {
|
||||||
// ClientAuth was hardcoded to REQUIRED in removed SSLContextFactory and overridden in SocketUtils when the socket is created
|
return SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTlsConfiguration(final TlsConfiguration tlsConfiguration) {
|
public void setTlsConfiguration(final TlsConfiguration tlsConfiguration) {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.apache.nifi.io.socket;
|
package org.apache.nifi.io.socket;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsException;
|
import org.apache.nifi.security.util.TlsException;
|
||||||
|
@ -35,8 +34,7 @@ public final class SocketConfiguration {
|
||||||
private TlsConfiguration tlsConfiguration;
|
private TlsConfiguration tlsConfiguration;
|
||||||
|
|
||||||
public SSLContext createSSLContext() throws TlsException {
|
public SSLContext createSSLContext() throws TlsException {
|
||||||
// This is only used for client sockets, so the client auth setting is ignored
|
return SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTlsConfiguration(final TlsConfiguration tlsConfiguration) {
|
public void setTlsConfiguration(final TlsConfiguration tlsConfiguration) {
|
||||||
|
|
|
@ -298,7 +298,7 @@ abstract class AbstractAMQPProcessor<T extends AMQPWorker> extends AbstractProce
|
||||||
final Boolean useCertAuthentication = context.getProperty(USE_CERT_AUTHENTICATION).asBoolean();
|
final Boolean useCertAuthentication = context.getProperty(USE_CERT_AUTHENTICATION).asBoolean();
|
||||||
|
|
||||||
if (sslService != null) {
|
if (sslService != null) {
|
||||||
final SSLContext sslContext = sslService.createSSLContext(ClientAuth.NONE);
|
final SSLContext sslContext = sslService.createContext();
|
||||||
cf.useSslProtocol(sslContext);
|
cf.useSslProtocol(sslContext);
|
||||||
|
|
||||||
if (useCertAuthentication) {
|
if (useCertAuthentication) {
|
||||||
|
|
|
@ -58,7 +58,6 @@ import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors;
|
import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors;
|
||||||
import org.apache.nifi.proxy.ProxyConfiguration;
|
import org.apache.nifi.proxy.ProxyConfiguration;
|
||||||
import org.apache.nifi.proxy.ProxySpec;
|
import org.apache.nifi.proxy.ProxySpec;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,7 +226,7 @@ public abstract class AbstractAWSProcessor<ClientType extends AmazonWebServiceCl
|
||||||
if(this.getSupportedPropertyDescriptors().contains(SSL_CONTEXT_SERVICE)) {
|
if(this.getSupportedPropertyDescriptors().contains(SSL_CONTEXT_SERVICE)) {
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.NONE);
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
// NIFI-3788: Changed hostnameVerifier from null to DHV (BrowserCompatibleHostnameVerifier is deprecated)
|
// NIFI-3788: Changed hostnameVerifier from null to DHV (BrowserCompatibleHostnameVerifier is deprecated)
|
||||||
SdkTLSSocketFactory sdkTLSSocketFactory = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier());
|
SdkTLSSocketFactory sdkTLSSocketFactory = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier());
|
||||||
config.getApacheHttpClientConfig().setSslSocketFactory(sdkTLSSocketFactory);
|
config.getApacheHttpClientConfig().setSslSocketFactory(sdkTLSSocketFactory);
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class ListenBeats extends AbstractListenEventBatchingProcessor<BeatsEvent
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuthValue));
|
sslContext = sslContextService.createContext();
|
||||||
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,24 +252,10 @@ public abstract class AbstractCassandraProcessor extends AbstractProcessor {
|
||||||
|
|
||||||
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
||||||
final SSLContextService sslService = context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslService = context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
final String rawClientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
|
||||||
final SSLContext sslContext;
|
final SSLContext sslContext;
|
||||||
|
|
||||||
if (sslService != null) {
|
if (sslService != null) {
|
||||||
final ClientAuth clientAuth;
|
sslContext = sslService.createContext();
|
||||||
|
|
||||||
if (StringUtils.isBlank(rawClientAuth)) {
|
|
||||||
clientAuth = ClientAuth.REQUIRED;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
clientAuth = ClientAuth.valueOf(rawClientAuth);
|
|
||||||
} catch (final IllegalArgumentException iae) {
|
|
||||||
throw new IllegalStateException(String.format("Unrecognized client auth '%s'. Possible values are [%s]",
|
|
||||||
rawClientAuth, StringUtils.join(ClientAuth.values(), ", ")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sslContext = sslService.createSSLContext(clientAuth);
|
|
||||||
} else {
|
} else {
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,23 +232,6 @@ public class AbstractCassandraProcessorTest {
|
||||||
assertNotNull(processor.getCluster());
|
assertNotNull(processor.getCluster());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalStateException.class)
|
|
||||||
public void testConnectToCassandraWithSSLBadClientAuth() throws Exception {
|
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
|
||||||
testRunner.enableControllerService(sslService);
|
|
||||||
testRunner.setProperty(AbstractCassandraProcessor.PROP_SSL_CONTEXT_SERVICE, "ssl-context");
|
|
||||||
testRunner.setProperty(AbstractCassandraProcessor.CONSISTENCY_LEVEL, "ONE");
|
|
||||||
testRunner.assertValid(sslService);
|
|
||||||
processor.connectToCassandra(testRunner.getProcessContext());
|
|
||||||
assertNotNull(processor.getCluster());
|
|
||||||
processor.setCluster(null);
|
|
||||||
// Try with a ClientAuth value
|
|
||||||
testRunner.setProperty(AbstractCassandraProcessor.CLIENT_AUTH, "BAD");
|
|
||||||
processor.connectToCassandra(testRunner.getProcessContext());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnectToCassandraUsernamePassword() throws Exception {
|
public void testConnectToCassandraUsernamePassword() throws Exception {
|
||||||
testRunner.setProperty(AbstractCassandraProcessor.USERNAME, "user");
|
testRunner.setProperty(AbstractCassandraProcessor.USERNAME, "user");
|
||||||
|
|
|
@ -28,12 +28,10 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||||
import org.apache.nifi.annotation.documentation.Tags;
|
import org.apache.nifi.annotation.documentation.Tags;
|
||||||
import org.apache.nifi.annotation.lifecycle.OnDisabled;
|
import org.apache.nifi.annotation.lifecycle.OnDisabled;
|
||||||
import org.apache.nifi.annotation.lifecycle.OnEnabled;
|
import org.apache.nifi.annotation.lifecycle.OnEnabled;
|
||||||
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
|
||||||
import org.apache.nifi.cassandra.CassandraSessionProviderService;
|
import org.apache.nifi.cassandra.CassandraSessionProviderService;
|
||||||
import org.apache.nifi.components.PropertyDescriptor;
|
import org.apache.nifi.components.PropertyDescriptor;
|
||||||
import org.apache.nifi.components.PropertyValue;
|
import org.apache.nifi.components.PropertyValue;
|
||||||
|
@ -219,24 +217,12 @@ public class CassandraSessionProvider extends AbstractControllerService implemen
|
||||||
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
||||||
final SSLContextService sslService =
|
final SSLContextService sslService =
|
||||||
context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
context.getProperty(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
final String rawClientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
|
||||||
final SSLContext sslContext;
|
final SSLContext sslContext;
|
||||||
|
|
||||||
if (sslService != null) {
|
if (sslService == null) {
|
||||||
final ClientAuth clientAuth;
|
|
||||||
if (StringUtils.isBlank(rawClientAuth)) {
|
|
||||||
clientAuth = ClientAuth.REQUIRED;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
clientAuth = ClientAuth.valueOf(rawClientAuth);
|
|
||||||
} catch (final IllegalArgumentException iae) {
|
|
||||||
throw new ProviderCreationException(String.format("Unrecognized client auth '%s'. Possible values are [%s]",
|
|
||||||
rawClientAuth, StringUtils.join(ClientAuth.values(), ", ")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sslContext = sslService.createSSLContext(clientAuth);
|
|
||||||
} else {
|
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
|
} else {
|
||||||
|
sslContext = sslService.createContext();;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String username, password;
|
final String username, password;
|
||||||
|
|
|
@ -51,13 +51,10 @@ import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.schema.access.SchemaField;
|
import org.apache.nifi.schema.access.SchemaField;
|
||||||
import org.apache.nifi.schema.access.SchemaNotFoundException;
|
import org.apache.nifi.schema.access.SchemaNotFoundException;
|
||||||
import org.apache.nifi.schemaregistry.services.SchemaRegistry;
|
import org.apache.nifi.schemaregistry.services.SchemaRegistry;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.serialization.record.RecordSchema;
|
import org.apache.nifi.serialization.record.RecordSchema;
|
||||||
import org.apache.nifi.serialization.record.SchemaIdentifier;
|
import org.apache.nifi.serialization.record.SchemaIdentifier;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Tags({"schema", "registry", "confluent", "avro", "kafka"})
|
@Tags({"schema", "registry", "confluent", "avro", "kafka"})
|
||||||
@CapabilityDescription("Provides a Schema Registry that interacts with the Confluent Schema Registry so that those Schemas that are stored in the Confluent Schema "
|
@CapabilityDescription("Provides a Schema Registry that interacts with the Confluent Schema Registry so that those Schemas that are stored in the Confluent Schema "
|
||||||
+ "Registry can be used in NiFi. The Confluent Schema Registry has a notion of a \"subject\" for schemas, which is their terminology for a schema name. When a Schema "
|
+ "Registry can be used in NiFi. The Confluent Schema Registry has a notion of a \"subject\" for schemas, which is their terminology for a schema name. When a Schema "
|
||||||
|
@ -171,7 +168,7 @@ public class ConfluentSchemaRegistry extends AbstractControllerService implement
|
||||||
if (sslContextService == null) {
|
if (sslContextService == null) {
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
} else {
|
} else {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String username = context.getProperty(USERNAME).getValue();
|
final String username = context.getProperty(USERNAME).getValue();
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.apache.nifi.controller.AbstractControllerService;
|
||||||
import org.apache.nifi.controller.ConfigurationContext;
|
import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.reporting.InitializationException;
|
import org.apache.nifi.reporting.InitializationException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.StopWatch;
|
import org.apache.nifi.util.StopWatch;
|
||||||
import org.apache.nifi.util.StringUtils;
|
import org.apache.nifi.util.StringUtils;
|
||||||
|
@ -125,7 +124,7 @@ public class ElasticSearchClientServiceImpl extends AbstractControllerService im
|
||||||
final SSLContext sslContext;
|
final SSLContext sslContext;
|
||||||
try {
|
try {
|
||||||
sslContext = (sslService != null && (sslService.isKeyStoreConfigured() || sslService.isTrustStoreConfigured()))
|
sslContext = (sslService != null && (sslService.isKeyStoreConfigured() || sslService.isTrustStoreConfigured()))
|
||||||
? sslService.createSSLContext(ClientAuth.NONE) : null;
|
? sslService.createContext() : null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getLogger().error("Error building up SSL Context from the supplied configuration.", e);
|
getLogger().error("Error building up SSL Context from the supplied configuration.", e);
|
||||||
throw new InitializationException(e);
|
throw new InitializationException(e);
|
||||||
|
|
|
@ -249,16 +249,16 @@ public class ListenSMTP extends AbstractSessionFactoryProcessor {
|
||||||
@Override
|
@Override
|
||||||
public SSLSocket createSSLSocket(Socket socket) throws IOException {
|
public SSLSocket createSSLSocket(Socket socket) throws IOException {
|
||||||
InetSocketAddress remoteAddress = (InetSocketAddress) socket.getRemoteSocketAddress();
|
InetSocketAddress remoteAddress = (InetSocketAddress) socket.getRemoteSocketAddress();
|
||||||
String clientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuth));
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
SSLSocketFactory socketFactory = sslContext.getSocketFactory();
|
final SSLSocketFactory socketFactory = sslContext.getSocketFactory();
|
||||||
SSLSocket sslSocket = (SSLSocket) (socketFactory.createSocket(socket, remoteAddress.getHostName(), socket.getPort(), true));
|
final SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(socket, remoteAddress.getHostName(), socket.getPort(), true);
|
||||||
final TlsConfiguration tlsConfiguration = sslContextService.createTlsConfiguration();
|
final TlsConfiguration tlsConfiguration = sslContextService.createTlsConfiguration();
|
||||||
sslSocket.setEnabledProtocols(tlsConfiguration.getEnabledProtocols());
|
sslSocket.setEnabledProtocols(tlsConfiguration.getEnabledProtocols());
|
||||||
|
|
||||||
sslSocket.setUseClientMode(false);
|
sslSocket.setUseClientMode(false);
|
||||||
|
|
||||||
if (ClientAuth.REQUIRED.toString().equals(clientAuth)) {
|
if (ClientAuth.REQUIRED.getType().equals(clientAuth)) {
|
||||||
this.setRequireTLS(true);
|
this.setRequireTLS(true);
|
||||||
sslSocket.setNeedClientAuth(true);
|
sslSocket.setNeedClientAuth(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.nifi.controller.queue.clustered.server
|
||||||
|
|
||||||
import org.apache.nifi.events.EventReporter
|
import org.apache.nifi.events.EventReporter
|
||||||
import org.apache.nifi.reporting.Severity
|
import org.apache.nifi.reporting.Severity
|
||||||
import org.apache.nifi.security.util.ClientAuth
|
|
||||||
import org.apache.nifi.security.util.KeyStoreUtils
|
import org.apache.nifi.security.util.KeyStoreUtils
|
||||||
import org.apache.nifi.security.util.KeystoreType
|
import org.apache.nifi.security.util.KeystoreType
|
||||||
import org.apache.nifi.security.util.SslContextFactory
|
import org.apache.nifi.security.util.SslContextFactory
|
||||||
|
@ -99,7 +98,7 @@ class ConnectionLoadBalanceServerTest extends GroovyTestCase {
|
||||||
void testRequestPeerListShouldUseTLS() {
|
void testRequestPeerListShouldUseTLS() {
|
||||||
// Arrange
|
// Arrange
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
|
|
||||||
def mockLBP = [
|
def mockLBP = [
|
||||||
|
|
|
@ -92,7 +92,6 @@ import org.apache.nifi.controller.repository.claim.ResourceClaimManager;
|
||||||
import org.apache.nifi.controller.repository.claim.StandardResourceClaimManager;
|
import org.apache.nifi.controller.repository.claim.StandardResourceClaimManager;
|
||||||
import org.apache.nifi.events.EventReporter;
|
import org.apache.nifi.events.EventReporter;
|
||||||
import org.apache.nifi.provenance.ProvenanceRepository;
|
import org.apache.nifi.provenance.ProvenanceRepository;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.KeystoreType;
|
import org.apache.nifi.security.util.KeystoreType;
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
|
@ -195,7 +194,7 @@ public class LoadBalancedQueueIT {
|
||||||
final String truststorePass = "wAOR0nQJ2EXvOP0JZ2EaqA/n7W69ILS4sWAHghmIWCc";
|
final String truststorePass = "wAOR0nQJ2EXvOP0JZ2EaqA/n7W69ILS4sWAHghmIWCc";
|
||||||
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(keystore, keystorePass, keyPass, KeystoreType.JKS,
|
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(keystore, keystorePass, keyPass, KeystoreType.JKS,
|
||||||
truststore, truststorePass, KeystoreType.JKS, TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
truststore, truststorePass, KeystoreType.JKS, TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
||||||
sslContext = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
sslContext = SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,11 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.remote
|
package org.apache.nifi.remote
|
||||||
|
|
||||||
|
|
||||||
import org.apache.nifi.security.util.ClientAuth
|
|
||||||
import org.apache.nifi.security.util.KeyStoreUtils
|
import org.apache.nifi.security.util.KeyStoreUtils
|
||||||
import org.apache.nifi.security.util.KeystoreType
|
import org.apache.nifi.security.util.KeystoreType
|
||||||
import org.apache.nifi.security.util.SslContextFactory
|
import org.apache.nifi.security.util.SslContextFactory
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration
|
import org.apache.nifi.security.util.StandardTlsConfiguration
|
||||||
import org.apache.nifi.security.util.TlsConfiguration
|
import org.apache.nifi.security.util.TlsConfiguration
|
||||||
import org.apache.nifi.security.util.TlsPlatform
|
|
||||||
import org.apache.nifi.util.NiFiProperties
|
import org.apache.nifi.util.NiFiProperties
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
|
@ -115,7 +112,7 @@ class SocketRemoteSiteListenerTest extends GroovyTestCase {
|
||||||
void testShouldCreateSecureServer() {
|
void testShouldCreateSecureServer() {
|
||||||
// Arrange
|
// Arrange
|
||||||
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
logger.info("Creating SSL Context from TLS Configuration: ${tlsConfiguration}")
|
||||||
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.NONE)
|
SSLContext sslContext = SslContextFactory.createSslContext(tlsConfiguration)
|
||||||
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
logger.info("Created SSL Context: ${KeyStoreUtils.sslContextToString(sslContext)}")
|
||||||
|
|
||||||
srsListener = new SocketRemoteSiteListener(PORT, sslContext, mockNiFiProperties)
|
srsListener = new SocketRemoteSiteListener(PORT, sslContext, mockNiFiProperties)
|
||||||
|
@ -130,11 +127,5 @@ class SocketRemoteSiteListenerTest extends GroovyTestCase {
|
||||||
logger.info("Created SSL server socket: ${KeyStoreUtils.sslServerSocketToString(sslServerSocket)}" as String)
|
logger.info("Created SSL server socket: ${KeyStoreUtils.sslServerSocketToString(sslServerSocket)}" as String)
|
||||||
assertProtocolVersions(sslServerSocket.enabledProtocols, TlsConfiguration.getCurrentSupportedTlsProtocolVersions())
|
assertProtocolVersions(sslServerSocket.enabledProtocols, TlsConfiguration.getCurrentSupportedTlsProtocolVersions())
|
||||||
assert sslServerSocket.needClientAuth
|
assert sslServerSocket.needClientAuth
|
||||||
|
|
||||||
// Assert that the default parameters (which can't be modified) still have legacy protocols and no client auth
|
|
||||||
def defaultSSLParameters = sslContext.defaultSSLParameters
|
|
||||||
logger.info("Default SSL Parameters: ${KeyStoreUtils.sslParametersToString(defaultSSLParameters)}" as String)
|
|
||||||
assertProtocolVersions(defaultSSLParameters.getProtocols(), TlsPlatform.supportedProtocols)
|
|
||||||
assert !defaultSSLParameters.needClientAuth
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.apache.nifi.stateless.config;
|
package org.apache.nifi.stateless.config;
|
||||||
|
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -36,7 +35,7 @@ public class SslConfigurationUtil {
|
||||||
final TlsConfiguration tlsConfiguration = createTlsConfiguration(sslContextDefinition);
|
final TlsConfiguration tlsConfiguration = createTlsConfiguration(sslContextDefinition);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
return SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new StatelessConfigurationException("Failed to create SSL Context", e);
|
throw new StatelessConfigurationException("Failed to create SSL Context", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.nifi.context.PropertyContext;
|
||||||
import org.apache.nifi.controller.ConfigurationContext;
|
import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.logging.ComponentLog;
|
import org.apache.nifi.logging.ComponentLog;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,7 +172,7 @@ public class JMSConnectionFactoryHandler implements IJMSConnectionFactoryProvide
|
||||||
|
|
||||||
SSLContextService sc = context.getProperty(JMS_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
SSLContextService sc = context.getProperty(JMS_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sc != null) {
|
if (sc != null) {
|
||||||
SSLContext ssl = sc.createSSLContext(ClientAuth.NONE);
|
SSLContext ssl = sc.createContext();
|
||||||
setProperty("sSLSocketFactory", ssl.getSocketFactory());
|
setProperty("sSLSocketFactory", ssl.getSocketFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.nifi.authentication.exception.InvalidLoginCredentialsException
|
||||||
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
||||||
import org.apache.nifi.authentication.exception.ProviderDestructionException;
|
import org.apache.nifi.authentication.exception.ProviderDestructionException;
|
||||||
import org.apache.nifi.configuration.NonComponentConfigurationContext;
|
import org.apache.nifi.configuration.NonComponentConfigurationContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -253,14 +252,12 @@ public class LdapProvider implements LoginIdentityProvider {
|
||||||
final String rawTruststore = configurationContext.getProperty("TLS - Truststore");
|
final String rawTruststore = configurationContext.getProperty("TLS - Truststore");
|
||||||
final String rawTruststorePassword = configurationContext.getProperty("TLS - Truststore Password");
|
final String rawTruststorePassword = configurationContext.getProperty("TLS - Truststore Password");
|
||||||
final String rawTruststoreType = configurationContext.getProperty("TLS - Truststore Type");
|
final String rawTruststoreType = configurationContext.getProperty("TLS - Truststore Type");
|
||||||
final String rawClientAuth = configurationContext.getProperty("TLS - Client Auth");
|
|
||||||
final String rawProtocol = configurationContext.getProperty("TLS - Protocol");
|
final String rawProtocol = configurationContext.getProperty("TLS - Protocol");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(rawKeystore, rawKeystorePassword, null, rawKeystoreType,
|
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(rawKeystore, rawKeystorePassword, null, rawKeystoreType,
|
||||||
rawTruststore, rawTruststorePassword, rawTruststoreType, rawProtocol);
|
rawTruststore, rawTruststorePassword, rawTruststoreType, rawProtocol);
|
||||||
ClientAuth clientAuth = ClientAuth.isValidClientAuthType(rawClientAuth) ? ClientAuth.valueOf(rawClientAuth) : ClientAuth.NONE;
|
return SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, clientAuth);
|
|
||||||
} catch (TlsException e) {
|
} catch (TlsException e) {
|
||||||
logger.error("Encountered an error configuring TLS for LDAP identity provider: {}", e.getLocalizedMessage());
|
logger.error("Encountered an error configuring TLS for LDAP identity provider: {}", e.getLocalizedMessage());
|
||||||
throw new ProviderCreationException("Error configuring TLS for LDAP identity provider", e);
|
throw new ProviderCreationException("Error configuring TLS for LDAP identity provider", e);
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.nifi.components.PropertyValue;
|
||||||
import org.apache.nifi.ldap.LdapAuthenticationStrategy;
|
import org.apache.nifi.ldap.LdapAuthenticationStrategy;
|
||||||
import org.apache.nifi.ldap.LdapsSocketFactory;
|
import org.apache.nifi.ldap.LdapsSocketFactory;
|
||||||
import org.apache.nifi.ldap.ReferralStrategy;
|
import org.apache.nifi.ldap.ReferralStrategy;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -827,14 +826,12 @@ public class LdapUserGroupProvider implements UserGroupProvider {
|
||||||
final String rawTruststore = configurationContext.getProperty("TLS - Truststore").getValue();
|
final String rawTruststore = configurationContext.getProperty("TLS - Truststore").getValue();
|
||||||
final String rawTruststorePassword = configurationContext.getProperty("TLS - Truststore Password").getValue();
|
final String rawTruststorePassword = configurationContext.getProperty("TLS - Truststore Password").getValue();
|
||||||
final String rawTruststoreType = configurationContext.getProperty("TLS - Truststore Type").getValue();
|
final String rawTruststoreType = configurationContext.getProperty("TLS - Truststore Type").getValue();
|
||||||
final String rawClientAuth = configurationContext.getProperty("TLS - Client Auth").getValue();
|
|
||||||
final String rawProtocol = configurationContext.getProperty("TLS - Protocol").getValue();
|
final String rawProtocol = configurationContext.getProperty("TLS - Protocol").getValue();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(rawKeystore, rawKeystorePassword, null, rawKeystoreType,
|
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration(rawKeystore, rawKeystorePassword, null, rawKeystoreType,
|
||||||
rawTruststore, rawTruststorePassword, rawTruststoreType, rawProtocol);
|
rawTruststore, rawTruststorePassword, rawTruststoreType, rawProtocol);
|
||||||
ClientAuth clientAuth = ClientAuth.isValidClientAuthType(rawClientAuth) ? ClientAuth.valueOf(rawClientAuth) : ClientAuth.NONE;
|
return SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, clientAuth);
|
|
||||||
} catch (TlsException e) {
|
} catch (TlsException e) {
|
||||||
logger.error("Encountered an error configuring TLS for LDAP user group provider: {}", e.getLocalizedMessage());
|
logger.error("Encountered an error configuring TLS for LDAP user group provider: {}", e.getLocalizedMessage());
|
||||||
throw new ProviderCreationException("Error configuring TLS for LDAP user group provider", e);
|
throw new ProviderCreationException("Error configuring TLS for LDAP user group provider", e);
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.apache.nifi.processors.lumberjack.frame.LumberjackEncoder;
|
||||||
import org.apache.nifi.processors.lumberjack.handler.LumberjackSocketChannelHandlerFactory;
|
import org.apache.nifi.processors.lumberjack.handler.LumberjackSocketChannelHandlerFactory;
|
||||||
import org.apache.nifi.processors.lumberjack.response.LumberjackChannelResponse;
|
import org.apache.nifi.processors.lumberjack.response.LumberjackChannelResponse;
|
||||||
import org.apache.nifi.processors.lumberjack.response.LumberjackResponse;
|
import org.apache.nifi.processors.lumberjack.response.LumberjackResponse;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.RestrictedSSLContextService;
|
import org.apache.nifi.ssl.RestrictedSSLContextService;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
|
@ -143,7 +142,7 @@ public class ListenLumberjack extends AbstractListenEventBatchingProcessor<Lumbe
|
||||||
SSLContext sslContext = null;
|
SSLContext sslContext = null;
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we decide to support SSL then get the context and pass it in here
|
// if we decide to support SSL then get the context and pass it in here
|
||||||
|
|
|
@ -241,22 +241,10 @@ public abstract class AbstractMongoProcessor extends AbstractProcessor {
|
||||||
|
|
||||||
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
||||||
final SSLContextService sslService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
final String rawClientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
|
||||||
final SSLContext sslContext;
|
final SSLContext sslContext;
|
||||||
|
|
||||||
if (sslService != null) {
|
if (sslService != null) {
|
||||||
final ClientAuth clientAuth;
|
sslContext = sslService.createContext();
|
||||||
if (StringUtils.isBlank(rawClientAuth)) {
|
|
||||||
clientAuth = ClientAuth.REQUIRED;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
clientAuth = ClientAuth.valueOf(rawClientAuth);
|
|
||||||
} catch (final IllegalArgumentException iae) {
|
|
||||||
throw new IllegalStateException(String.format("Unrecognized client auth '%s'. Possible values are [%s]",
|
|
||||||
rawClientAuth, StringUtils.join(ClientAuth.values(), ", ")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sslContext = sslService.createSSLContext(clientAuth);
|
|
||||||
} else {
|
} else {
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.apache.nifi.processors.mongodb;
|
package org.apache.nifi.processors.mongodb;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.mockito.Mockito.any;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ import javax.net.ssl.SSLContext;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.ProcessSession;
|
import org.apache.nifi.processor.ProcessSession;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
import org.apache.nifi.util.TestRunners;
|
import org.apache.nifi.util.TestRunners;
|
||||||
|
@ -46,11 +44,11 @@ public class AbstractMongoProcessorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testcreateClientWithSSL() throws Exception {
|
public void testCreateClientWithSSL() throws Exception {
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
SSLContextService sslService = mock(SSLContextService.class);
|
||||||
SSLContext sslContext = mock(SSLContext.class);
|
SSLContext sslContext = mock(SSLContext.class);
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
||||||
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
when(sslService.createContext()).thenReturn(sslContext);
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
testRunner.addControllerService("ssl-context", sslService);
|
||||||
testRunner.enableControllerService(sslService);
|
testRunner.enableControllerService(sslService);
|
||||||
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
||||||
|
@ -59,30 +57,10 @@ public class AbstractMongoProcessorTest {
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
assertNotNull(processor.mongoClient);
|
assertNotNull(processor.mongoClient);
|
||||||
processor.mongoClient = null;
|
processor.mongoClient = null;
|
||||||
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "WANT");
|
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
assertNotNull(processor.mongoClient);
|
assertNotNull(processor.mongoClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalStateException.class)
|
|
||||||
public void testcreateClientWithSSLBadClientAuth() throws Exception {
|
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
|
||||||
SSLContext sslContext = mock(SSLContext.class);
|
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
|
||||||
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
|
||||||
testRunner.enableControllerService(sslService);
|
|
||||||
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
|
||||||
testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
|
||||||
testRunner.assertValid(sslService);
|
|
||||||
processor.createClient(testRunner.getProcessContext());
|
|
||||||
assertNotNull(processor.mongoClient);
|
|
||||||
processor.mongoClient = null;
|
|
||||||
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "BAD");
|
|
||||||
processor.createClient(testRunner.getProcessContext());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stubbed processor instance for testing
|
* Provides a stubbed processor instance for testing
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,7 +25,6 @@ import com.mongodb.client.MongoDatabase;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||||
import org.apache.nifi.annotation.documentation.Tags;
|
import org.apache.nifi.annotation.documentation.Tags;
|
||||||
import org.apache.nifi.annotation.lifecycle.OnDisabled;
|
import org.apache.nifi.annotation.lifecycle.OnDisabled;
|
||||||
|
@ -34,7 +33,6 @@ import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||||
import org.apache.nifi.components.PropertyDescriptor;
|
import org.apache.nifi.components.PropertyDescriptor;
|
||||||
import org.apache.nifi.controller.AbstractControllerService;
|
import org.apache.nifi.controller.AbstractControllerService;
|
||||||
import org.apache.nifi.controller.ConfigurationContext;
|
import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
@Tags({"mongo", "mongodb", "service"})
|
@Tags({"mongo", "mongodb", "service"})
|
||||||
|
@ -71,24 +69,12 @@ public class MongoDBControllerService extends AbstractControllerService implemen
|
||||||
|
|
||||||
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
// Set up the client for secure (SSL/TLS communications) if configured to do so
|
||||||
final SSLContextService sslService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
final String rawClientAuth = context.getProperty(CLIENT_AUTH).getValue();
|
|
||||||
final SSLContext sslContext;
|
final SSLContext sslContext;
|
||||||
|
|
||||||
if (sslService != null) {
|
if (sslService == null) {
|
||||||
final ClientAuth clientAuth;
|
|
||||||
if (StringUtils.isBlank(rawClientAuth)) {
|
|
||||||
clientAuth = ClientAuth.REQUIRED;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
clientAuth = ClientAuth.valueOf(rawClientAuth);
|
|
||||||
} catch (final IllegalArgumentException iae) {
|
|
||||||
throw new IllegalStateException(String.format("Unrecognized client auth '%s'. Possible values are [%s]",
|
|
||||||
rawClientAuth, StringUtils.join(ClientAuth.values(), ", ")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sslContext = sslService.createSSLContext(clientAuth);
|
|
||||||
} else {
|
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
|
} else {
|
||||||
|
sslContext = sslService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.apache.nifi.remote.protocol.SiteToSiteTransportProtocol;
|
||||||
import org.apache.nifi.remote.protocol.http.HttpProxy;
|
import org.apache.nifi.remote.protocol.http.HttpProxy;
|
||||||
import org.apache.nifi.remote.util.SiteToSiteRestApiClient;
|
import org.apache.nifi.remote.util.SiteToSiteRestApiClient;
|
||||||
import org.apache.nifi.reporting.ReportingContext;
|
import org.apache.nifi.reporting.ReportingContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.RestrictedSSLContextService;
|
import org.apache.nifi.ssl.RestrictedSSLContextService;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.StringUtils;
|
import org.apache.nifi.util.StringUtils;
|
||||||
|
@ -147,7 +146,7 @@ public class SiteToSiteUtils {
|
||||||
|
|
||||||
public static SiteToSiteClient getClient(PropertyContext reportContext, ComponentLog logger, StateManager stateManager) {
|
public static SiteToSiteClient getClient(PropertyContext reportContext, ComponentLog logger, StateManager stateManager) {
|
||||||
final SSLContextService sslContextService = reportContext.getProperty(SiteToSiteUtils.SSL_CONTEXT).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = reportContext.getProperty(SiteToSiteUtils.SSL_CONTEXT).asControllerService(SSLContextService.class);
|
||||||
final SSLContext sslContext = sslContextService == null ? null : sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
final SSLContext sslContext = sslContextService == null ? null : sslContextService.createContext();
|
||||||
final EventReporter eventReporter = (EventReporter) (severity, category, message) -> {
|
final EventReporter eventReporter = (EventReporter) (severity, category, message) -> {
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case WARNING:
|
case WARNING:
|
||||||
|
|
|
@ -55,7 +55,6 @@ import org.apache.nifi.kerberos.KerberosCredentialsService;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.io.OutputStreamCallback;
|
import org.apache.nifi.processor.io.OutputStreamCallback;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.serialization.RecordSetWriterFactory;
|
import org.apache.nifi.serialization.RecordSetWriterFactory;
|
||||||
import org.apache.nifi.serialization.record.DataType;
|
import org.apache.nifi.serialization.record.DataType;
|
||||||
import org.apache.nifi.serialization.record.ListRecordSet;
|
import org.apache.nifi.serialization.record.ListRecordSet;
|
||||||
|
@ -78,13 +77,9 @@ import org.apache.solr.common.SolrDocument;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||||
import org.apache.solr.common.params.MultiMapSolrParams;
|
import org.apache.solr.common.params.MultiMapSolrParams;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class SolrUtils {
|
public class SolrUtils {
|
||||||
|
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(SolrUtils.class);
|
|
||||||
|
|
||||||
public static final AllowableValue SOLR_TYPE_CLOUD = new AllowableValue(
|
public static final AllowableValue SOLR_TYPE_CLOUD = new AllowableValue(
|
||||||
"Cloud", "Cloud", "A SolrCloud instance.");
|
"Cloud", "Cloud", "A SolrCloud instance.");
|
||||||
|
|
||||||
|
@ -251,7 +246,7 @@ public class SolrUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
final SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext);
|
final SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext);
|
||||||
HttpClientUtil.setSchemaRegistryProvider(new HttpClientUtil.SchemaRegistryProvider() {
|
HttpClientUtil.setSchemaRegistryProvider(new HttpClientUtil.SchemaRegistryProvider() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,11 @@ public class MockSSLContextService extends AbstractControllerService implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SSLContext createContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSLContext createSSLContext(org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException {
|
public SSLContext createSSLContext(org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -77,7 +77,6 @@ import org.apache.nifi.hadoop.KerberosKeytabSPNegoAuthSchemeProvider;
|
||||||
import org.apache.nifi.kerberos.KerberosCredentialsService;
|
import org.apache.nifi.kerberos.KerberosCredentialsService;
|
||||||
import org.apache.nifi.logging.ComponentLog;
|
import org.apache.nifi.logging.ComponentLog;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.codehaus.jettison.json.JSONException;
|
import org.codehaus.jettison.json.JSONException;
|
||||||
import org.codehaus.jettison.json.JSONObject;
|
import org.codehaus.jettison.json.JSONObject;
|
||||||
|
@ -225,7 +224,7 @@ public class LivySessionController extends AbstractControllerService implements
|
||||||
final String jars = context.getProperty(JARS).evaluateAttributeExpressions().getValue();
|
final String jars = context.getProperty(JARS).evaluateAttributeExpressions().getValue();
|
||||||
final String files = context.getProperty(FILES).evaluateAttributeExpressions().getValue();
|
final String files = context.getProperty(FILES).evaluateAttributeExpressions().getValue();
|
||||||
sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
sslContext = sslContextService == null ? null : sslContextService.createSSLContext(ClientAuth.NONE);
|
sslContext = sslContextService == null ? null : sslContextService.createContext();
|
||||||
connectTimeout = Math.toIntExact(context.getProperty(CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS));
|
connectTimeout = Math.toIntExact(context.getProperty(CONNECT_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS));
|
||||||
credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class);
|
credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.processor.io.InputStreamCallback;
|
import org.apache.nifi.processor.io.InputStreamCallback;
|
||||||
import org.apache.nifi.processor.util.put.AbstractPutEventProcessor;
|
import org.apache.nifi.processor.util.put.AbstractPutEventProcessor;
|
||||||
import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.stream.io.ByteCountingInputStream;
|
import org.apache.nifi.stream.io.ByteCountingInputStream;
|
||||||
import org.apache.nifi.stream.io.StreamUtils;
|
import org.apache.nifi.stream.io.StreamUtils;
|
||||||
|
@ -120,7 +119,7 @@ public class PutSplunk extends AbstractPutEventProcessor {
|
||||||
|
|
||||||
SSLContext sslContext = null;
|
SSLContext sslContext = null;
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return createSender(protocol, host, port, timeout, maxSendBuffer, sslContext);
|
return createSender(protocol, host, port, timeout, maxSendBuffer, sslContext);
|
||||||
|
|
|
@ -98,7 +98,6 @@ import org.apache.nifi.processor.Relationship;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.processors.standard.util.HTTPUtils;
|
import org.apache.nifi.processors.standard.util.HTTPUtils;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.KeyStoreUtils;
|
import org.apache.nifi.security.util.KeyStoreUtils;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.StopWatch;
|
import org.apache.nifi.util.StopWatch;
|
||||||
|
@ -439,7 +438,8 @@ public class GetHTTP extends AbstractSessionFactoryProcessor {
|
||||||
|
|
||||||
// set the ssl context if necessary
|
// set the ssl context if necessary
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
clientBuilder.setSslcontext(sslContextService.createSSLContext(ClientAuth.REQUIRED));
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
|
clientBuilder.setSSLContext(sslContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String username = context.getProperty(USERNAME).getValue();
|
final String username = context.getProperty(USERNAME).getValue();
|
||||||
|
|
|
@ -403,12 +403,19 @@ public class ListenHTTP extends AbstractSessionFactoryProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SslContextFactory createSslContextFactory(SSLContextService sslContextService, final ClientAuth clientAuth) {
|
private SslContextFactory createSslContextFactory(SSLContextService sslContextService, final ClientAuth clientAuth) {
|
||||||
final SslContextFactory contextFactory = new SslContextFactory.Server();
|
final SslContextFactory.Server contextFactory = new SslContextFactory.Server();
|
||||||
final SSLContext sslContext = sslContextService.createSSLContext(clientAuth);
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
contextFactory.setSslContext(sslContext);
|
contextFactory.setSslContext(sslContext);
|
||||||
|
|
||||||
final TlsConfiguration tlsConfiguration = sslContextService.createTlsConfiguration();
|
final TlsConfiguration tlsConfiguration = sslContextService.createTlsConfiguration();
|
||||||
contextFactory.setIncludeProtocols(tlsConfiguration.getEnabledProtocols());
|
contextFactory.setIncludeProtocols(tlsConfiguration.getEnabledProtocols());
|
||||||
|
|
||||||
|
if (ClientAuth.REQUIRED.equals(clientAuth)) {
|
||||||
|
contextFactory.setNeedClientAuth(true);
|
||||||
|
} else if (ClientAuth.WANT.equals(clientAuth)) {
|
||||||
|
contextFactory.setWantClientAuth(true);
|
||||||
|
}
|
||||||
|
|
||||||
return contextFactory;
|
return contextFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,8 @@ public class ListenRELP extends AbstractListenEventBatchingProcessor<RELPEvent>
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuthValue));
|
sslContext = sslContextService.createContext();
|
||||||
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we decide to support SSL then get the context and pass it in here
|
// if we decide to support SSL then get the context and pass it in here
|
||||||
|
|
|
@ -347,7 +347,7 @@ public class ListenSyslog extends AbstractSyslogProcessor {
|
||||||
|
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuthValue));
|
sslContext = sslContextService.createContext();
|
||||||
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class ListenTCP extends AbstractListenEventBatchingProcessor<StandardEven
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuthValue));
|
sslContext = sslContextService.createContext();
|
||||||
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class ListenTCPRecord extends AbstractProcessor {
|
||||||
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
final String clientAuthValue = context.getProperty(CLIENT_AUTH).getValue();
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.valueOf(clientAuthValue));
|
sslContext = sslContextService.createContext();
|
||||||
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
clientAuth = ClientAuth.valueOf(clientAuthValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
||||||
import org.apache.nifi.processor.util.put.sender.DatagramChannelSender;
|
import org.apache.nifi.processor.util.put.sender.DatagramChannelSender;
|
||||||
import org.apache.nifi.processor.util.put.sender.SSLSocketChannelSender;
|
import org.apache.nifi.processor.util.put.sender.SSLSocketChannelSender;
|
||||||
import org.apache.nifi.processor.util.put.sender.SocketChannelSender;
|
import org.apache.nifi.processor.util.put.sender.SocketChannelSender;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.syslog.parsers.SyslogParser;
|
import org.apache.nifi.syslog.parsers.SyslogParser;
|
||||||
import org.apache.nifi.util.StopWatch;
|
import org.apache.nifi.util.StopWatch;
|
||||||
|
@ -249,7 +248,7 @@ public class PutSyslog extends AbstractSyslogProcessor {
|
||||||
} else {
|
} else {
|
||||||
// if an SSLContextService is provided then we make a secure sender
|
// if an SSLContextService is provided then we make a secure sender
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
sender = new SSLSocketChannelSender(host, port, maxSendBufferSize, sslContext, getLogger());
|
sender = new SSLSocketChannelSender(host, port, maxSendBufferSize, sslContext, getLogger());
|
||||||
} else {
|
} else {
|
||||||
sender = new SocketChannelSender(host, port, maxSendBufferSize, getLogger());
|
sender = new SocketChannelSender(host, port, maxSendBufferSize, getLogger());
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.processor.util.put.AbstractPutEventProcessor;
|
import org.apache.nifi.processor.util.put.AbstractPutEventProcessor;
|
||||||
import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
||||||
import org.apache.nifi.processor.util.put.sender.SocketChannelSender;
|
import org.apache.nifi.processor.util.put.sender.SocketChannelSender;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.StopWatch;
|
import org.apache.nifi.util.StopWatch;
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ public class PutTCP extends AbstractPutEventProcessor {
|
||||||
|
|
||||||
SSLContext sslContext = null;
|
SSLContext sslContext = null;
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return createSender(protocol, hostname, port, timeout, bufferSize, sslContext);
|
return createSender(protocol, hostname, port, timeout, bufferSize, sslContext);
|
||||||
|
|
|
@ -366,7 +366,7 @@ class TestGetHTTPGroovy extends GroovyTestCase {
|
||||||
runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, KEYSTORE_TYPE)
|
runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, KEYSTORE_TYPE)
|
||||||
runner.setProperty(sslContextService, StandardSSLContextService.SSL_ALGORITHM, protocol)
|
runner.setProperty(sslContextService, StandardSSLContextService.SSL_ALGORITHM, protocol)
|
||||||
runner.enableControllerService(sslContextService)
|
runner.enableControllerService(sslContextService)
|
||||||
def sslContext = sslContextService.createSSLContext(org.apache.nifi.security.util.ClientAuth.NONE)
|
def sslContext = sslContextService.createContext();
|
||||||
logger.info("GetHTTP supported protocols: ${sslContext.protocol}")
|
logger.info("GetHTTP supported protocols: ${sslContext.protocol}")
|
||||||
logger.info("GetHTTP supported cipher suites: ${sslContext.supportedSSLParameters.cipherSuites}")
|
logger.info("GetHTTP supported cipher suites: ${sslContext.supportedSSLParameters.cipherSuites}")
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ class TestPostHTTPGroovy extends GroovyTestCase {
|
||||||
runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, KEYSTORE_TYPE)
|
runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, KEYSTORE_TYPE)
|
||||||
runner.setProperty(sslContextService, StandardSSLContextService.SSL_ALGORITHM, protocol)
|
runner.setProperty(sslContextService, StandardSSLContextService.SSL_ALGORITHM, protocol)
|
||||||
runner.enableControllerService(sslContextService)
|
runner.enableControllerService(sslContextService)
|
||||||
def sslContext = sslContextService.createSSLContext(org.apache.nifi.security.util.ClientAuth.NONE)
|
def sslContext = sslContextService.createContext();
|
||||||
logger.info("PostHTTP supported protocols: ${sslContext.protocol}")
|
logger.info("PostHTTP supported protocols: ${sslContext.protocol}")
|
||||||
logger.info("PostHTTP supported cipher suites: ${sslContext.supportedSSLParameters.cipherSuites}")
|
logger.info("PostHTTP supported cipher suites: ${sslContext.supportedSSLParameters.cipherSuites}")
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ import org.apache.nifi.http.HttpContextMap;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processors.standard.util.HTTPUtils;
|
import org.apache.nifi.processors.standard.util.HTTPUtils;
|
||||||
import org.apache.nifi.reporting.InitializationException;
|
import org.apache.nifi.reporting.InitializationException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -107,7 +106,7 @@ public class ITestHandleHttpRequest {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SSLContext useSSLContextService(final TestRunner controller, final Map<String, String> sslProperties, ClientAuth clientAuth) {
|
private static SSLContext useSSLContextService(final TestRunner controller, final Map<String, String> sslProperties) {
|
||||||
final SSLContextService service = new StandardRestrictedSSLContextService();
|
final SSLContextService service = new StandardRestrictedSSLContextService();
|
||||||
try {
|
try {
|
||||||
controller.addControllerService("ssl-service", service, sslProperties);
|
controller.addControllerService("ssl-service", service, sslProperties);
|
||||||
|
@ -118,7 +117,7 @@ public class ITestHandleHttpRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.setProperty(HandleHttpRequest.SSL_CONTEXT, "ssl-service");
|
controller.setProperty(HandleHttpRequest.SSL_CONTEXT, "ssl-service");
|
||||||
return service.createSSLContext(clientAuth);
|
return service.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -653,7 +652,7 @@ public class ITestHandleHttpRequest {
|
||||||
final Map<String, String> sslProperties = getServerKeystoreProperties();
|
final Map<String, String> sslProperties = getServerKeystoreProperties();
|
||||||
sslProperties.putAll(getTruststoreProperties());
|
sslProperties.putAll(getTruststoreProperties());
|
||||||
sslProperties.put(StandardSSLContextService.SSL_ALGORITHM.getName(), TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
sslProperties.put(StandardSSLContextService.SSL_ALGORITHM.getName(), TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
||||||
useSSLContextService(runner, sslProperties, twoWaySsl ? ClientAuth.REQUIRED : ClientAuth.NONE);
|
useSSLContextService(runner, sslProperties);
|
||||||
|
|
||||||
final Thread httpThread = new Thread(new Runnable() {
|
final Thread httpThread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.nifi.processors.standard.relp.response.RELPResponse;
|
||||||
import org.apache.nifi.provenance.ProvenanceEventRecord;
|
import org.apache.nifi.provenance.ProvenanceEventRecord;
|
||||||
import org.apache.nifi.provenance.ProvenanceEventType;
|
import org.apache.nifi.provenance.ProvenanceEventType;
|
||||||
import org.apache.nifi.reporting.InitializationException;
|
import org.apache.nifi.reporting.InitializationException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.ssl.StandardSSLContextService;
|
import org.apache.nifi.ssl.StandardSSLContextService;
|
||||||
import org.apache.nifi.util.MockFlowFile;
|
import org.apache.nifi.util.MockFlowFile;
|
||||||
|
@ -226,7 +225,7 @@ public class TestListenRELP {
|
||||||
|
|
||||||
// create either a regular socket or ssl socket based on context being passed in
|
// create either a regular socket or ssl socket based on context being passed in
|
||||||
if (sslContextService != null) {
|
if (sslContextService != null) {
|
||||||
final SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
final SSLContext sslContext = sslContextService.createContext();
|
||||||
socket = sslContext.getSocketFactory().createSocket("localhost", realPort);
|
socket = sslContext.getSocketFactory().createSocket("localhost", realPort);
|
||||||
} else {
|
} else {
|
||||||
socket = new Socket("localhost", realPort);
|
socket = new Socket("localhost", realPort);
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class TestListenTCP {
|
||||||
messages.add("This is message 5\n");
|
messages.add("This is message 5\n");
|
||||||
|
|
||||||
// Make an SSLContext with a key and trust store to send the test messages
|
// Make an SSLContext with a key and trust store to send the test messages
|
||||||
final SSLContext clientSslContext = SslContextFactory.createSslContext(clientTlsConfiguration, ClientAuth.NONE);
|
final SSLContext clientSslContext = SslContextFactory.createSslContext(clientTlsConfiguration);
|
||||||
|
|
||||||
runTCP(messages, messages.size(), clientSslContext);
|
runTCP(messages, messages.size(), clientSslContext);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import javax.net.ServerSocketFactory;
|
import javax.net.ServerSocketFactory;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.SslContextFactory;
|
import org.apache.nifi.security.util.SslContextFactory;
|
||||||
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
import org.apache.nifi.security.util.StandardTlsConfiguration;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
|
@ -57,7 +56,7 @@ public class TCPTestServer implements Runnable {
|
||||||
if(ssl){
|
if(ssl){
|
||||||
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration("src/test/resources/keystore.jks","passwordpassword", null, "JKS", "src/test/resources/truststore.jks",
|
TlsConfiguration tlsConfiguration = new StandardTlsConfiguration("src/test/resources/keystore.jks","passwordpassword", null, "JKS", "src/test/resources/truststore.jks",
|
||||||
"passwordpassword", "JKS", TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
"passwordpassword", "JKS", TlsConfiguration.getHighestCurrentSupportedTlsProtocolVersion());
|
||||||
final SSLContext sslCtx = SslContextFactory.createSslContext(tlsConfiguration, ClientAuth.REQUIRED);
|
final SSLContext sslCtx = SslContextFactory.createSslContext(tlsConfiguration);
|
||||||
|
|
||||||
ServerSocketFactory sslSocketFactory = sslCtx.getServerSocketFactory();
|
ServerSocketFactory sslSocketFactory = sslCtx.getServerSocketFactory();
|
||||||
serverSocket = sslSocketFactory.createServerSocket(0, 0, ipAddress);
|
serverSocket = sslSocketFactory.createServerSocket(0, 0, ipAddress);
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.apache.nifi.distributed.cache.protocol.exception.HandshakeException;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.remote.StandardVersionNegotiator;
|
import org.apache.nifi.remote.StandardVersionNegotiator;
|
||||||
import org.apache.nifi.remote.VersionNegotiator;
|
import org.apache.nifi.remote.VersionNegotiator;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -408,7 +407,7 @@ public class DistributedMapCacheClientService extends AbstractControllerService
|
||||||
if (sslContextService == null) {
|
if (sslContextService == null) {
|
||||||
commsSession = new StandardCommsSession(hostname, port, timeoutMillis);
|
commsSession = new StandardCommsSession(hostname, port, timeoutMillis);
|
||||||
} else {
|
} else {
|
||||||
commsSession = new SSLCommsSession(sslContextService.createSSLContext(ClientAuth.REQUIRED), hostname, port, timeoutMillis);
|
commsSession = new SSLCommsSession(sslContextService.createContext(), hostname, port, timeoutMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
commsSession.setTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
|
commsSession.setTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.apache.nifi.distributed.cache.protocol.exception.HandshakeException;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.remote.StandardVersionNegotiator;
|
import org.apache.nifi.remote.StandardVersionNegotiator;
|
||||||
import org.apache.nifi.remote.VersionNegotiator;
|
import org.apache.nifi.remote.VersionNegotiator;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -115,7 +114,7 @@ public class DistributedSetCacheClientService extends AbstractControllerService
|
||||||
if (sslContextService == null) {
|
if (sslContextService == null) {
|
||||||
commsSession = new StandardCommsSession(hostname, port, timeoutMillis);
|
commsSession = new StandardCommsSession(hostname, port, timeoutMillis);
|
||||||
} else {
|
} else {
|
||||||
commsSession = new SSLCommsSession(sslContextService.createSSLContext(ClientAuth.REQUIRED), hostname, port, timeoutMillis);
|
commsSession = new SSLCommsSession(sslContextService.createContext(), hostname, port, timeoutMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
commsSession.setTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
|
commsSession.setTimeout(timeoutMillis, TimeUnit.MILLISECONDS);
|
||||||
|
|
|
@ -21,7 +21,6 @@ import javax.net.ssl.SSLContext;
|
||||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||||
import org.apache.nifi.annotation.documentation.Tags;
|
import org.apache.nifi.annotation.documentation.Tags;
|
||||||
import org.apache.nifi.controller.ConfigurationContext;
|
import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
@Tags({"distributed", "set", "distinct", "cache", "server"})
|
@Tags({"distributed", "set", "distinct", "cache", "server"})
|
||||||
|
@ -41,7 +40,7 @@ public class DistributedSetCacheServer extends DistributedCacheServer {
|
||||||
if (sslContextService == null) {
|
if (sslContextService == null) {
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
} else {
|
} else {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
final EvictionPolicy evictionPolicy;
|
final EvictionPolicy evictionPolicy;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.distributed.cache.server.CacheServer;
|
import org.apache.nifi.distributed.cache.server.CacheServer;
|
||||||
import org.apache.nifi.distributed.cache.server.DistributedCacheServer;
|
import org.apache.nifi.distributed.cache.server.DistributedCacheServer;
|
||||||
import org.apache.nifi.distributed.cache.server.EvictionPolicy;
|
import org.apache.nifi.distributed.cache.server.EvictionPolicy;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
|
||||||
@Tags({"distributed", "cluster", "map", "cache", "server", "key/value"})
|
@Tags({"distributed", "cluster", "map", "cache", "server", "key/value"})
|
||||||
|
@ -47,7 +46,7 @@ public class DistributedMapCacheServer extends DistributedCacheServer {
|
||||||
if (sslContextService == null) {
|
if (sslContextService == null) {
|
||||||
sslContext = null;
|
sslContext = null;
|
||||||
} else {
|
} else {
|
||||||
sslContext = sslContextService.createSSLContext(ClientAuth.REQUIRED);
|
sslContext = sslContextService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
final EvictionPolicy evictionPolicy;
|
final EvictionPolicy evictionPolicy;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.nifi.components.PropertyDescriptor;
|
||||||
import org.apache.nifi.controller.AbstractControllerService;
|
import org.apache.nifi.controller.AbstractControllerService;
|
||||||
import org.apache.nifi.controller.ConfigurationContext;
|
import org.apache.nifi.controller.ConfigurationContext;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.security.util.OkHttpClientUtils;
|
import org.apache.nifi.security.util.OkHttpClientUtils;
|
||||||
import org.apache.nifi.security.util.TlsConfiguration;
|
import org.apache.nifi.security.util.TlsConfiguration;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
|
@ -60,7 +59,7 @@ public class OAuth2TokenProviderImpl extends AbstractControllerService implement
|
||||||
|
|
||||||
sslService = context.getProperty(SSL_CONTEXT).asControllerService(SSLContextService.class);
|
sslService = context.getProperty(SSL_CONTEXT).asControllerService(SSLContextService.class);
|
||||||
|
|
||||||
sslContext = sslService == null ? null : sslService.createSSLContext(ClientAuth.NONE);
|
sslContext = sslService == null ? null : sslService.createContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -238,41 +238,57 @@ public class StandardSSLContextService extends AbstractControllerService impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the populated configuration values. This method is preferred
|
* Create and initialize {@link SSLContext} using configured properties. This method is preferred over deprecated
|
||||||
* over the overloaded method which accepts the deprecated {@link ClientAuth} enum.
|
* methods due to not requiring a client authentication policy. Invokes createTlsConfiguration() to prepare
|
||||||
|
* properties for processing.
|
||||||
*
|
*
|
||||||
* @param clientAuth the desired level of client authentication
|
* @return {@link SSLContext} initialized using configured properties
|
||||||
* @return the configured SSLContext
|
|
||||||
* @throws ProcessException if there is a problem configuring the context
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SSLContext createSSLContext(final org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException {
|
public SSLContext createContext() {
|
||||||
try {
|
|
||||||
final TlsConfiguration tlsConfiguration = createTlsConfiguration();
|
final TlsConfiguration tlsConfiguration = createTlsConfiguration();
|
||||||
if (!tlsConfiguration.isTruststorePopulated()) {
|
if (!tlsConfiguration.isTruststorePopulated()) {
|
||||||
getLogger().warn("Trust Store properties not found: using platform default Certificate Authorities");
|
getLogger().warn("Trust Store properties not found: using platform default Certificate Authorities");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
final TrustManager[] trustManagers = SslContextFactory.getTrustManagers(tlsConfiguration);
|
final TrustManager[] trustManagers = SslContextFactory.getTrustManagers(tlsConfiguration);
|
||||||
return SslContextFactory.createSslContext(tlsConfiguration, trustManagers, clientAuth);
|
return SslContextFactory.createSslContext(tlsConfiguration, trustManagers);
|
||||||
} catch (TlsException e) {
|
} catch (final TlsException e) {
|
||||||
getLogger().error("Encountered an error creating the SSL context from the SSL context service: {}", new String[]{e.getLocalizedMessage()});
|
getLogger().error("Unable to create SSLContext: {}", new String[]{e.getLocalizedMessage()});
|
||||||
throw new ProcessException("Error creating SSL context", e);
|
throw new ProcessException("Unable to create SSLContext", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
||||||
* due to the use of the deprecated {@link ClientAuth} enum and the overloaded method
|
* due to the Client Authentication policy not being applicable when initializing the SSLContext
|
||||||
* ({@link #createSSLContext(org.apache.nifi.security.util.ClientAuth)}) is preferred.
|
|
||||||
*
|
*
|
||||||
* @param clientAuth the desired level of client authentication
|
* @param clientAuth the desired level of client authentication
|
||||||
* @return the configured SSLContext
|
* @return the configured SSLContext
|
||||||
* @throws ProcessException if there is a problem configuring the context
|
* @throws ProcessException if there is a problem configuring the context
|
||||||
|
* @deprecated The {@link #createContext()} method should be used instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public SSLContext createSSLContext(final org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException {
|
||||||
|
return createContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
||||||
|
* due to the use of the deprecated {@link ClientAuth} enum
|
||||||
|
* {@link #createContext()} method is preferred.
|
||||||
|
*
|
||||||
|
* @param clientAuth the desired level of client authentication
|
||||||
|
* @return the configured SSLContext
|
||||||
|
* @throws ProcessException if there is a problem configuring the context
|
||||||
|
* @deprecated The {@link #createContext()} method should be used instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public SSLContext createSSLContext(final ClientAuth clientAuth) throws ProcessException {
|
public SSLContext createSSLContext(final ClientAuth clientAuth) throws ProcessException {
|
||||||
org.apache.nifi.security.util.ClientAuth resolvedClientAuth = org.apache.nifi.security.util.ClientAuth.valueOf(clientAuth.name());
|
return createContext();
|
||||||
return createSSLContext(resolvedClientAuth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -176,7 +176,7 @@ class StandardSSLContextServiceTest {
|
||||||
runner.assertValid(sslContextService)
|
runner.assertValid(sslContextService)
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.NONE)
|
SSLContext sslContext = sslContextService.createContext();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert sslContext
|
assert sslContext
|
||||||
|
@ -198,7 +198,7 @@ class StandardSSLContextServiceTest {
|
||||||
runner.assertValid(sslContextService)
|
runner.assertValid(sslContextService)
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
SSLContext sslContext = sslContextService.createSSLContext(ClientAuth.NONE)
|
SSLContext sslContext = sslContextService.createContext();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assert sslContext
|
assert sslContext
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.nifi.components.AllowableValue;
|
||||||
import org.apache.nifi.components.ValidationContext;
|
import org.apache.nifi.components.ValidationContext;
|
||||||
import org.apache.nifi.components.ValidationResult;
|
import org.apache.nifi.components.ValidationResult;
|
||||||
import org.apache.nifi.reporting.InitializationException;
|
import org.apache.nifi.reporting.InitializationException;
|
||||||
import org.apache.nifi.security.util.ClientAuth;
|
|
||||||
import org.apache.nifi.util.MockProcessContext;
|
import org.apache.nifi.util.MockProcessContext;
|
||||||
import org.apache.nifi.util.MockValidationContext;
|
import org.apache.nifi.util.MockValidationContext;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
|
@ -146,9 +145,7 @@ public class SSLContextServiceTest {
|
||||||
service = (SSLContextService) runner.getProcessContext().getControllerServiceLookup().getControllerService("test-good1");
|
service = (SSLContextService) runner.getProcessContext().getControllerServiceLookup().getControllerService("test-good1");
|
||||||
Assert.assertNotNull(service);
|
Assert.assertNotNull(service);
|
||||||
SSLContextService sslService = service;
|
SSLContextService sslService = service;
|
||||||
sslService.createSSLContext(ClientAuth.REQUIRED);
|
sslService.createContext();
|
||||||
sslService.createSSLContext(ClientAuth.WANT);
|
|
||||||
sslService.createSSLContext(ClientAuth.NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -257,7 +254,7 @@ public class SSLContextServiceTest {
|
||||||
runner.assertValid();
|
runner.assertValid();
|
||||||
Assert.assertNotNull(service);
|
Assert.assertNotNull(service);
|
||||||
assertTrue(service instanceof StandardSSLContextService);
|
assertTrue(service instanceof StandardSSLContextService);
|
||||||
service.createSSLContext(ClientAuth.NONE);
|
service.createContext();
|
||||||
} catch (InitializationException e) {
|
} catch (InitializationException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +277,7 @@ public class SSLContextServiceTest {
|
||||||
Assert.assertNotNull(service);
|
Assert.assertNotNull(service);
|
||||||
assertTrue(service instanceof StandardSSLContextService);
|
assertTrue(service instanceof StandardSSLContextService);
|
||||||
SSLContextService sslService = service;
|
SSLContextService sslService = service;
|
||||||
sslService.createSSLContext(ClientAuth.NONE);
|
sslService.createContext();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
Assert.fail("Should not have thrown a exception " + e.getMessage());
|
Assert.fail("Should not have thrown a exception " + e.getMessage());
|
||||||
|
@ -311,7 +308,7 @@ public class SSLContextServiceTest {
|
||||||
runner.setProperty("SSL Context Svc ID", "test-diff-keys");
|
runner.setProperty("SSL Context Svc ID", "test-diff-keys");
|
||||||
runner.assertValid();
|
runner.assertValid();
|
||||||
Assert.assertNotNull(service);
|
Assert.assertNotNull(service);
|
||||||
service.createSSLContext(ClientAuth.NONE);
|
service.createContext();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
Assert.fail("Should not have thrown a exception " + e.getMessage());
|
Assert.fail("Should not have thrown a exception " + e.getMessage());
|
||||||
|
|
|
@ -56,26 +56,38 @@ public interface SSLContextService extends ControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the populated configuration values. This method is preferred
|
* Create and initialize {@link SSLContext} using configured properties. This method is preferred over deprecated
|
||||||
* over the overloaded method which accepts the deprecated {@link ClientAuth} enum.
|
* create methods due to not requiring a client authentication policy.
|
||||||
*
|
*
|
||||||
* @param clientAuth the desired level of client authentication
|
* @return {@link SSLContext} initialized using configured properties
|
||||||
* @return the configured SSLContext
|
|
||||||
* @throws ProcessException if there is a problem configuring the context
|
|
||||||
*/
|
*/
|
||||||
SSLContext createSSLContext(final org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException;
|
SSLContext createContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
||||||
* due to the use of the deprecated {@link ClientAuth} enum and the overloaded method
|
* due to {@link org.apache.nifi.security.util.ClientAuth} not being applicable or used when initializing the
|
||||||
* ({@link #createSSLContext(org.apache.nifi.security.util.ClientAuth)}) is preferred.
|
* {@link SSLContext}
|
||||||
*
|
*
|
||||||
* @param clientAuth the desired level of client authentication
|
* @param clientAuth the desired level of client authentication
|
||||||
* @return the configured SSLContext
|
* @return the configured SSLContext
|
||||||
* @throws ProcessException if there is a problem configuring the context
|
* @throws ProcessException if there is a problem configuring the context
|
||||||
|
* @deprecated The {@link #createContext()} method should be used instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
SSLContext createSSLContext(final ClientAuth clientAuth) throws ProcessException;
|
SSLContext createSSLContext(org.apache.nifi.security.util.ClientAuth clientAuth) throws ProcessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a configured {@link SSLContext} from the populated configuration values. This method is deprecated
|
||||||
|
* due to the use of the deprecated {@link ClientAuth} enum and the
|
||||||
|
* ({@link #createContext()}) method is preferred.
|
||||||
|
*
|
||||||
|
* @param clientAuth the desired level of client authentication
|
||||||
|
* @return the configured SSLContext
|
||||||
|
* @throws ProcessException if there is a problem configuring the context
|
||||||
|
* @deprecated The {@link #createContext()} method should be used instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
SSLContext createSSLContext(ClientAuth clientAuth) throws ProcessException;
|
||||||
|
|
||||||
String getTrustStoreFile();
|
String getTrustStoreFile();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue