Class SecurityConfig


  • public class SecurityConfig
    extends Object
    The SecurityConfig allows to enable transport encryption between the client and the servers.
    • Method Detail

      • create

        public static SecurityConfig create()
        Creates a SecurityConfig with the default configuration.
        Returns:
        the default security config.
      • enableTls

        public static SecurityConfig.Builder enableTls​(boolean tlsEnabled)
        Enables TLS for all client/server communication (disabled by default).
        Parameters:
        tlsEnabled - true if enabled, false otherwise.
        Returns:
        this SecurityConfig.Builder for chaining purposes.
      • enableNativeTls

        public static SecurityConfig.Builder enableNativeTls​(boolean nativeTlsEnabled)
        Enables/disables native TLS (enabled by default).
        Parameters:
        nativeTlsEnabled - true if it should be enabled, false otherwise.
        Returns:
        this SecurityConfig.Builder for chaining purposes.
      • trustCertificate

        public static SecurityConfig.Builder trustCertificate​(Path certificatePath)
        Loads a X.509 trust certificate from the given path and uses it.
        Parameters:
        certificatePath - the path to load the certificate from.
        Returns:
        this SecurityConfig.Builder for chaining purposes.
      • tlsEnabled

        public boolean tlsEnabled()
        True if TLS is enabled, false otherwise.
        Returns:
        a boolean if tls/transport encryption is enabled.
      • trustCertificates

        public List<X509Certificate> trustCertificates()
        The list of trust certificates that should be used, if present.
        Returns:
        the list of certificates.
      • trustManagerFactory

        public TrustManagerFactory trustManagerFactory()
        The currently configured trust manager factory, if present.
        Returns:
        the trust manager factory.
      • nativeTlsEnabled

        public boolean nativeTlsEnabled()
        Returns whether native TLS is enabled.
        Returns:
        true if enabled, false otherwise.
      • decodeCertificates

        public static List<X509Certificate> decodeCertificates​(List<String> certificates)
        Helper method to decode string-encoded certificates into their x.509 format.
        Parameters:
        certificates - the string-encoded certificates.
        Returns:
        the decoded certs in x.509 format.