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

AuthTypeChange: Adds new API to update the AuthType dynamically #4822

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirankumarkolli
Copy link
Member

@kirankumarkolli kirankumarkolli commented Oct 18, 2024

Pull Request Template

Description

Scenario: Change authentication type between keybased to MSI dynamically with-out re-creating client

Below is a sample mock-up

            LocalEmulatorTokenCredential miTokenCredential = new LocalEmulatorTokenCredential(authKey);
            CosmosAuthorizationTokenProvider authorizationTokenProvider = CosmosAuthorizationTokenProvider.FromTokenCredential(endpoint, miTokenCredential);

            using (CosmosClient client = new CosmosClient(
                    endpoint,
                    miTokenCredential))
            {
                // do some work 

                // Change authentication type to key-based creds
                AzureKeyCredential masterKeyCredential = new AzureKeyCredential(authKey);
                authorizationTokenProvider.Update(CosmosAuthorizationTokenProvider.FromAzureKeyCredential(masterKeyCredential));

                // do some work 
            }

Option 2: de-couple the ProviderFactory and Provider adds one more Type, CosmosClient didn't follow this pattern)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Closing issues

To automatically close an issue: closes #IssueNumber

@kirankumarkolli kirankumarkolli self-assigned this Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

2 participants