Class TlsPolicy

java.lang.Object
org.apache.pulsar.client.api.v5.config.TlsPolicy

public final class TlsPolicy extends Object
TLS configuration for the Pulsar client connection.

Construct via builder(), or use ofInsecure() for development.

  • Method Details

    • trustCertsFilePath

      public String trustCertsFilePath()
      Returns:
      path to the trusted CA certificate file (PEM), or null when not set
    • keyFilePath

      public String keyFilePath()
      Returns:
      path to the client private key file (PEM), or null when not using mTLS
    • certificateFilePath

      public String certificateFilePath()
      Returns:
      path to the client certificate file (PEM), or null when not using mTLS
    • allowInsecureConnection

      public boolean allowInsecureConnection()
      Returns:
      whether connections to brokers with untrusted certificates are allowed
    • enableHostnameVerification

      public boolean enableHostnameVerification()
      Returns:
      whether the broker hostname is verified against the certificate
    • ofInsecure

      public static TlsPolicy ofInsecure()
      Create an insecure TLS policy that accepts any certificate (for development only).
      Returns:
      a TlsPolicy with insecure connections allowed and hostname verification disabled
    • builder

      public static TlsPolicy.Builder builder()
      Returns:
      a new builder for constructing a TlsPolicy