Skip to content

Commit 3d279b0

Browse files
committed
docs: add complete mTLS section with Go and Java examples
Add a comprehensive Mutual TLS (mTLS) section to the Configure TLS documentation covering all three mTLS modes with Go and Java examples: 1. In-memory PEM bytes (static, no reload) - Go: WithMutualTLS(cert, key) - Java: useMutualTls(byte[], byte[]) 2. Path-based with default reload (300 seconds) - Go: WithMutualTLSFromFiles(certPath, keyPath) - Java: useMutualTlsWithReload(certPath, keyPath) 3. Path-based with custom reload interval - Go: WithMutualTLSFromFiles() with WithReloadInterval(d) - Java: useMutualTlsWithReload(certPath, keyPath, intervalSecs) Also includes helper methods example (LoadClientCertificateAndKeyFromFile in both languages) and a comprehensive Common Pitfalls section addressing file permissions, reload cadence semantics, mode exclusivity, interval validation, and the requirement for use_tls=True. Python, Node.js, C#, and PHP tabs remain "Coming soon" pending their implementation.
1 parent bc881f5 commit 3d279b0

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • src/content/docs/how-to/security

src/content/docs/how-to/security/tls.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ The advanced TLS configuration only supplies the client-side material.
545545

546546
#### In-memory PEM (static)
547547

548-
Use `WithMutualTLS(cert, key)` when the client certificate and key are already loaded as PEM bytes.
548+
Use `WithMutualTLS(cert, key)` (Go) or `useMutualTls(byte[], byte[])` (Java) when the client certificate and key are already loaded as PEM bytes.
549549

550550
<Tabs syncKey="progLangInExamples">
551551
<TabItem label="Python">
@@ -601,12 +601,12 @@ Use `WithMutualTLS(cert, key)` when the client certificate and key are already l
601601
func ConnectClusterWithMutualTLSBytes() error {
602602
// Load certificate and key bytes from a secret store (not from source).
603603
clientCert := []byte(`-----BEGIN CERTIFICATE-----
604-
MIIDXTCCAkWgAwIBAgIJAKL0UG+mRKmzMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
605-
...
606-
-----END CERTIFICATE-----`)
604+
MIIDXTCCAkWgAwIBAgIJAKL0UG+mRKmzMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
605+
...
606+
-----END CERTIFICATE-----`)
607607
clientKey := []byte(`-----BEGIN PRIVATE KEY-----
608-
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7...
609-
-----END PRIVATE KEY-----`)
608+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7...
609+
-----END PRIVATE KEY-----`)
610610

611611
// Create TLS configuration with in-memory client cert and key.
612612
// The cert and key are loaded once at connection time (static, no reload).
@@ -651,7 +651,7 @@ Use `WithMutualTLS(cert, key)` when the client certificate and key are already l
651651

652652
#### Path-based with automatic reload
653653

654-
Use `WithMutualTLSFromFiles(certPath, keyPath)` to point at files on disk; the core re-reads the material at its default cadence (currently 300 seconds).
654+
Use `WithMutualTLSFromFiles(certPath, keyPath)` (Go) or `useMutualTlsWithReload(certPath, keyPath)` (Java) to point at files on disk; the core re-reads the material at its default cadence (currently 300 seconds).
655655

656656
<Tabs syncKey="progLangInExamples">
657657
<TabItem label="Python">
@@ -748,7 +748,7 @@ Use `WithMutualTLSFromFiles(certPath, keyPath)` to point at files on disk; the c
748748

749749
#### Path-based with a custom reload interval
750750

751-
Pass a positive duration to `WithReloadInterval(d)` to override the core default (currently 300 seconds).
751+
Pass a positive interval in seconds to override the core default. In Java, use `useMutualTlsWithReload(certPath, keyPath, intervalSecs)`. In Go, pass `config.WithReloadInterval(d)` to `WithMutualTLSFromFiles()`.
752752

753753
<Tabs syncKey="progLangInExamples">
754754
<TabItem label="Python">

0 commit comments

Comments
 (0)