Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sruke opened this issue Sep 5, 2023 · 1 comment · Fixed by #2438
Closed
Assignees
Labels
enhancement New feature or request feature request

Comments

@sruke
Copy link
Contributor

sruke commented Sep 5, 2023

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

@sruke sruke added enhancement New feature or request feature request labels Sep 5, 2023
@sruke sruke self-assigned this Sep 5, 2023
@jennyf19
Copy link
Collaborator

jennyf19 commented Sep 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants