NCO-60: Add mTLS (client certificate) authorization#54
Merged
davidkelly merged 8 commits intomasterfrom Apr 8, 2026
Merged
Conversation
Redesign ICredential as a single-property interface (AuthorizationHeader) and add JwtCredential for Bearer token auth alongside the existing Credential record. Both credential types pre-compute their auth header at construction. Add Func<ICredential> provider pattern through AuthenticationHandler to enable credential hot-swap without rebuilding the HTTP pipeline. Cluster.UpdateCredential() performs a thread-safe volatile swap with a same-type guard. Preserve backward compatibility: * Add Credential-typed forwarding overloads on Cluster.Create() for binary compat with existing compiled applications * Override PrintMembers on credential records to prevent leaking passwords, tokens, and auth headers into ToString() output Add unit tests for credentials, AuthenticationHandler, and UpdateCredential.
* Add CertificateCredential with FromPkcs12 and FromPem factory methods * Skip Authorization header for mTLS — authentication via TLS handshake * Rebuild HTTP handler on certificate rotation with deferred disposal (1-minute grace period for in-flight request draining) * Scope handler rebuilds to CertificateCredential changes only * Add functional tests using cbdinocluster client certs, including credential swap test with a second user * Add unit tests for handler lifecycle behavior * Update README and getting-started docs
Collaborator
Author
|
NOTE: this is based on dk/59 branch - which is #53 |
emilienbev
reviewed
Apr 7, 2026
emilienbev
reviewed
Apr 7, 2026
| /// Excludes sensitive certificate details from the record's ToString output. | ||
| /// Only Subject and Thumbprint are included. | ||
| /// </summary> | ||
| private bool PrintMembers(StringBuilder builder) |
Collaborator
There was a problem hiding this comment.
Did you mean this to be protected?
Suggested change
| private bool PrintMembers(StringBuilder builder) | |
| protected bool PrintMembers(StringBuilder builder) |
Collaborator
Author
There was a problem hiding this comment.
Since the class is sealed, private seems fine. Nobody can derive a class from it, so no need for any subclass access to it.
emilienbev
reviewed
Apr 7, 2026
emilienbev
reviewed
Apr 7, 2026
emilienbev
reviewed
Apr 7, 2026
emilienbev
reviewed
Apr 7, 2026
emilienbev
reviewed
Apr 7, 2026
src/Couchbase.Analytics/Internal/HTTP/CouchbaseHttpClientFactory.cs
Outdated
Show resolved
Hide resolved
emilienbev
reviewed
Apr 7, 2026
emilienbev
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(1-minute grace period for in-flight request draining)
credential swap test with a second user