NCO-59: Add JWT credential support with runtime credential hot-swap#53
Closed
davidkelly wants to merge 3 commits into
Closed
NCO-59: Add JWT credential support with runtime credential hot-swap#53davidkelly wants to merge 3 commits into
davidkelly wants to merge 3 commits into
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.
Collaborator
Author
|
NOTE: in the next PR we will have mTLS support. That one will insure that we don't have pooled connections using old credentials when creds are changed during a cluster's lifecycle. So ignore that shortcoming here. |
Collaborator
Author
|
did this combined with nco-60 in #54, as it was built on top of this PR. |
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.
Redesign
ICredentialas a single-property interface (AuthorizationHeader) and addJwtCredentialfor Bearer token auth alongside the existing Credential record. Both credential types pre-compute their auth header at construction.Add
Func<ICredential>provider pattern throughAuthenticationHandlerto 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:
Cluster.Create()for binary compat with existing compiled applicationsPrintMemberson credential records to prevent leaking passwords, tokens, and auth headers intoToString()outputAdd unit tests for credentials,
AuthenticationHandler,andUpdateCredential. Added simple functional tests for Jwt as well.