refactor(rust): extract a credential refresher from the credential retriever #7614
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.
This PR refactors part of the support for refreshing credentials in the background.
Configuration
The configuration for the
CredentialRetriever
is now just limited to pure data.CredentialRetrieverOptions
are:This provides a better separation between "configuring" and "initializing / running".
Refresher creation
The instantiation of a
CredentialsRefresher
, for a given issuer + identity is done at the last moment, when creating a secure channel:CredentialsRetrieverCreator
.Retrievers / Refreshers
The functionality for retrieving credentials has been divided into:
IssuerClient
: can create a secure channel to an issuer on another node and ask for a credentialCredentialRequest
: can be executed to issue a credential for a specific pair issuer / subjectrun()
method calling the issuer client and then caching the issued credential.CredentialsCache
: stores credentials locally and makes sure that they are not expired when they are retrieved from storage.CredentialIssuer
: this struct represents an issuer that we wish to access to get credentialsCredentialRefresher
: periodically asks the credential issuer to get new credentials so that we never have expiredcredentials for a given identity. It can also notify subscribers that new credentials are available.
This feature is used to send a
CredentialRefresh
message on secure channels used by the subject.RemoteCredentialRetriever
: implementation of aCredentialRetriever
accessing a remote issuer.It can spawn refreshers, one per subject.