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

Implement Cosmos AAD authentication #1338

Merged
merged 4 commits into from
Sep 5, 2023
Merged

Conversation

johnbatty
Copy link
Contributor

@johnbatty johnbatty commented Aug 17, 2023

Add support for Cosmos AAD authentication via TokenCredential:

  • Extended AuthorizationToken enum to add TokenCredential variant
  • Added new AuthorizationToken::from_token_credential(...) constructor
  • Removed PartialEq and Eq implementations from AuthorizationToken, as it is difficult to compare dyn TokenCredential instances, and I'm going to assert that users probably don't need to compare AuthorizationTokens.
  • Updated generate_authorization(...) to be async and return a Result<...>, as it now has to be able to call token_credential.get_token(...)
  • Did not implement TokenCredential support for PermissionTokens, as it doesn't seem to make sense to support AAD for these.

Added new example document_entries_aad.rs to demonstrate and test the new function (I've tested it and it works).

Fixes: #1230

@johnbatty johnbatty marked this pull request as ready for review September 4, 2023 21:48
@demoray demoray merged commit 7cd9b80 into Azure:main Sep 5, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cosmos client support for TokenCredential
2 participants