Class TlsConfigHelper
- java.lang.Object
-
- glide.managers.TlsConfigHelper
-
public final class TlsConfigHelper extends java.lang.ObjectTLS configuration helpers shared by connection builders.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConnectionRequestOuterClass.ClientCertReloadConfigbuildCertReloadConfig(BaseClientConfiguration configuration)Builds theConnectionRequestOuterClass.ClientCertReloadConfigto send when path-based certificate reload is requested, ornullwhen reload is not requested.static java.lang.IntegerextractCertReloadIntervalSeconds(BaseClientConfiguration configuration)Returns the certificate reload interval override in seconds, ornullwhen the interval is deferred to the GLIDE core's default cadence.static byte[]extractClientCertificate(BaseClientConfiguration configuration)Returns the client certificate bytes for mutual TLS, ornullif not configured.static java.lang.StringextractClientCertPath(BaseClientConfiguration configuration)Returns the client certificate file path for path-based mutual TLS, ornullif not configured.static byte[]extractClientKey(BaseClientConfiguration configuration)Returns the client private key bytes for mutual TLS, ornullif not configured.static java.lang.StringextractClientKeyPath(BaseClientConfiguration configuration)Returns the client key file path for path-based mutual TLS, ornullif not configured.static byte[]extractRootCertificates(BaseClientConfiguration configuration)Returns the root certificates bytes, ornullif not configured.static booleanisCertReloadEnabled(BaseClientConfiguration configuration)Returnstrueif automatic certificate reload is requested for path-based mTLS.static booleanresolveInsecureTls(BaseClientConfiguration configuration)Returnstrueif insecure TLS is requested, throws if misconfigured.
-
-
-
Method Detail
-
resolveInsecureTls
public static boolean resolveInsecureTls(BaseClientConfiguration configuration)
Returnstrueif insecure TLS is requested, throws if misconfigured.
-
extractRootCertificates
public static byte[] extractRootCertificates(BaseClientConfiguration configuration)
Returns the root certificates bytes, ornullif not configured.
-
extractClientCertificate
public static byte[] extractClientCertificate(BaseClientConfiguration configuration)
Returns the client certificate bytes for mutual TLS, ornullif 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, ornullif 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, ornullif 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, ornullif 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)
Returnstrueif 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
useMutualTlsWithReloadoverload), whether or not an interval was supplied. This returnstrueboth 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, ornullwhen the interval is deferred to the GLIDE core's default cadence.
-
buildCertReloadConfig
public static ConnectionRequestOuterClass.ClientCertReloadConfig buildCertReloadConfig(BaseClientConfiguration configuration)
Builds theConnectionRequestOuterClass.ClientCertReloadConfigto send when path-based certificate reload is requested, ornullwhen reload is not requested.The returned config always has
enabled = true.interval_secondsis set only when an explicit positive override is configured; when the interval is deferred to the core the field is left unset, so the GLIDE core applies its own default cadence.
-
-