Class TlsConfigHelper


  • public final class TlsConfigHelper
    extends java.lang.Object
    TLS configuration helpers shared by connection builders.
    • Method Detail

      • resolveInsecureTls

        public static boolean resolveInsecureTls​(BaseClientConfiguration configuration)
        Returns true if insecure TLS is requested, throws if misconfigured.
      • extractRootCertificates

        public static byte[] extractRootCertificates​(BaseClientConfiguration configuration)
        Returns the root certificates bytes, or null if not configured.
      • extractClientCertificate

        public static byte[] extractClientCertificate​(BaseClientConfiguration configuration)
        Returns the client certificate bytes for mutual TLS, or null if not configured.

        Validates that the client certificate and client key are both provided together (mTLS requires both), and that neither is an empty (non-null, length 0) byte array.

        Throws:
        ConfigurationError - if only one of certificate/key is provided, or if either value is empty.
      • extractClientKey

        public static byte[] extractClientKey​(BaseClientConfiguration configuration)
        Returns the client private key bytes for mutual TLS, or null if not configured.

        Validates that the client certificate and client key are both provided together (mTLS requires both), and that neither is an empty (non-null, length 0) byte array.

        Throws:
        ConfigurationError - if only one of certificate/key is provided, or if either value is empty.
      • extractClientCertPath

        public static java.lang.String extractClientCertPath​(BaseClientConfiguration configuration)
        Returns the client certificate file path for path-based mutual TLS, or null if not configured.

        Validates that the certificate path and key path are both provided together, and that path-based and byte-based client certificate configuration are not mixed.

        Throws:
        ConfigurationError - if only one of the certificate/key path is provided, or if path- based and byte-based client certificate configuration are both provided.
      • extractClientKeyPath

        public static java.lang.String extractClientKeyPath​(BaseClientConfiguration configuration)
        Returns the client key file path for path-based mutual TLS, or null if not configured.
        Throws:
        ConfigurationError - if only one of the certificate/key path is provided, or if path- based and byte-based client certificate configuration are both provided.
      • isCertReloadEnabled

        public static boolean isCertReloadEnabled​(BaseClientConfiguration configuration)
        Returns true if automatic certificate reload is requested for path-based mTLS.

        Enablement is separate from the interval: reload is enabled whenever a path-based client certificate is configured (set by either useMutualTlsWithReload overload), whether or not an interval was supplied. This returns true both when the interval is deferred to the core (null) and when an explicit positive interval is set.

      • extractCertReloadIntervalSeconds

        public static java.lang.Integer extractCertReloadIntervalSeconds​(BaseClientConfiguration configuration)
        Returns the certificate reload interval override in seconds, or null when the interval is deferred to the GLIDE core's default cadence.