Class TlsConfig

java.lang.Object
io.flipt.client.models.TlsConfig

public class TlsConfig extends Object
TLS configuration for connecting to Flipt servers with custom certificates.

This class provides comprehensive TLS configuration options including:

  • Custom CA certificates for self-signed or private CAs
  • Client certificates for mutual TLS authentication
  • Certificate data as strings or file paths
  • Insecure mode for development (skip certificate verification)

Certificate data fields take precedence over file path fields when both are provided.

  • Constructor Details

    • TlsConfig

      public TlsConfig()
  • Method Details

    • getCaCertFile

      public Optional<String> getCaCertFile()
      Path to custom CA certificate file in PEM format. Used to verify server certificates signed by custom or self-signed CAs.
    • getCaCertData

      public Optional<String> getCaCertData()
      Raw CA certificate content in PEM format. Used to verify server certificates signed by custom or self-signed CAs. Takes precedence over caCertFile when both are provided.
    • getInsecureSkipVerify

      public Optional<Boolean> getInsecureSkipVerify()
      Skip certificate verification entirely. WARNING: This should only be used in development environments. Setting this to true makes connections vulnerable to man-in-the-middle attacks.
    • getInsecureSkipHostnameVerify

      public Optional<Boolean> getInsecureSkipHostnameVerify()
      Skip hostname verification while maintaining certificate validation. WARNING: This should only be used when you know what you are doing. This still validates the certificate chain.
    • getClientCertFile

      public Optional<String> getClientCertFile()
      Path to client certificate file in PEM format. Used for mutual TLS authentication where the server requires client certificates.
    • getClientKeyFile

      public Optional<String> getClientKeyFile()
      Path to client private key file in PEM format. Used for mutual TLS authentication where the server requires client certificates. Must correspond to the clientCertFile.
    • getClientCertData

      public Optional<String> getClientCertData()
      Raw client certificate content in PEM format. Used for mutual TLS authentication where the server requires client certificates. Takes precedence over clientCertFile when both are provided.
    • getClientKeyData

      public Optional<String> getClientKeyData()
      Raw client private key content in PEM format. Used for mutual TLS authentication where the server requires client certificates. Must correspond to the clientCertData. Takes precedence over clientKeyFile when both are provided.
    • insecure

      public static TlsConfig insecure()
      Deprecated.
      Use builder().insecureSkipVerify(true) instead. Creates a TlsConfig for development with insecure certificate verification disabled. WARNING: Only use this in development environments.
      Returns:
      TlsConfig with insecure skip verify enabled
    • withCaCertFile

      public static TlsConfig withCaCertFile(String caCertFile)
      Deprecated.
      Use builder().caCertFile(caCertFile) instead. Creates a TlsConfig with a custom CA certificate from a file.
      Parameters:
      caCertFile - path to the CA certificate file in PEM format
      Returns:
      TlsConfig with custom CA certificate
      Throws:
      IllegalArgumentException - if the certificate file does not exist
    • withCaCertData

      public static TlsConfig withCaCertData(String caCertData)
      Deprecated.
      Use builder().caCertData(caCertData) instead. Creates a TlsConfig with a custom CA certificate from string data.
      Parameters:
      caCertData - CA certificate content in PEM format
      Returns:
      TlsConfig with custom CA certificate
    • withMutualTls

      public static TlsConfig withMutualTls(String clientCertFile, String clientKeyFile)
      Deprecated.
      Use builder().clientCertFile(clientCertFile).clientKeyFile(clientKeyFile) instead. Creates a TlsConfig for mutual TLS with client certificate and key files.
      Parameters:
      clientCertFile - path to client certificate file in PEM format
      clientKeyFile - path to client private key file in PEM format
      Returns:
      TlsConfig with mutual TLS configuration
      Throws:
      IllegalArgumentException - if either certificate file or key file does not exist
    • withMutualTlsData

      public static TlsConfig withMutualTlsData(String clientCertData, String clientKeyData)
      Deprecated.
      Use builder().clientCertData(clientCertData).clientKeyData(clientKeyData) instead. Creates a TlsConfig for mutual TLS with client certificate and key data.
      Parameters:
      clientCertData - client certificate content in PEM format
      clientKeyData - client private key content in PEM format
      Returns:
      TlsConfig with mutual TLS configuration