EventHubsSharedKeyCredential should allow the shared key to be updated
See original GitHub issueSummary
The first preview of the track two Event Hubs client library exposed a credential type for using the shared key without a connection string; this type was based on the generic TokenCredential
and accepted by the EventHubClient
as a generic credential.
There is no current means to allow for the key to be rotated after the credential was created; each refresh of the token will make use of the same shared key. A means should be provided, ia method call, to provide a new shared key that will update the internal state and be used for generation of the next access token.
Success Criteria
-
The shared key held by the credential may be updated in-place without the need to stop processing or create a new token.
-
The tests necessary for its validation have been created and pass reliably.
-
The existing test suite continues to produce deterministic results and pass reliably.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Closing, as the associated PR has been merged. Thanks to @albertodenatale for contributing this feature!
I think is very clear thank you.
I will try to go on with that as much as I can, I will then come back to you.
SharedAccessSignatureRotatedCredential
Sitting at a high level, do you think it could be a valid idea having the
EventHubsSharedKeyCredential
constructor taking all the keys and passing them toSharedAccessSignatureCredential
?Looking at
SharedAccessSignatureCredential:::GetToken()
the keys could then be automatically rotated when theSignatureExpiration
has passed?That would offer an alternative to calling
UpdateSharedAccessKey
and arguably would tie nicely with what is already in place?Or there could be a separate token like
SharedAccessSignatureRotatedCredential
that could do that?Design
As I started coding, popped this question out in my mind:
Would the design open the door in future for something to call
SharedAccessSignatureCredential::UpdateSharedAccessKey
without callingEventHubSharedKeyCredential::UpdateSharedAccessKey
potentially leaving theEventHubSharedKeyCredential::SharedAccessKey
property misaligned fromSharedAccessSignatureCredential::SharedAccessSignature::SharedAccessKeyName
?(that would stand also for
EventHubSharedKeyCredential::SharedAccessKey
)And
Thank you this means a lot to me