Skip to content

[Feature Request] Introduce a lock while loading credentials from Credential Source #2439

@sruke

Description

@sruke

Is your feature request related to a problem? Please describe.
Today it is possible for multiple requests to attempt to load the same CredentialDescription from the same source when DefaultCredentialsLoader.LoadCredentialsIfNeededAsync API is invoked. This can be expensive when the HTTP request needs to be sent to access a certificate from KeyVault.

Describe the solution you'd like
Introduce a lock such that only a single request is attempting to load the same CredentialDescription. Allow concurrent loading of different credentialDescriptions. A request should be able to access and read the value of the credentialDescription.CachedValue property to recognize that a given credential has already been loaded and cached, thereby preventing unnecessary thread blocking.

Microsoft recommends using the SemaphoreSlim class for synchronization within a single app

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions