Skip to content

Commit

Permalink
[object_store] support azure managed and workload identities (#3581)
Browse files Browse the repository at this point in the history
* feat: add azure managed identity credential

* test: azure managed identity credential

* feat: add azure federated token credential

* test: add workload identity test

* refactor: PR feedback

* Update object_store/src/azure/mod.rs

Co-authored-by: Raphael Taylor-Davies <[email protected]>

* refactor: id priorities

* refactor: use managed identity as default credential

* chore: remove usused parameter

Co-authored-by: Raphael Taylor-Davies <[email protected]>
  • Loading branch information
roeap and tustvold authored Jan 25, 2023
1 parent f0be9da commit 73ce076
Show file tree
Hide file tree
Showing 3 changed files with 459 additions and 33 deletions.
8 changes: 5 additions & 3 deletions object_store/src/azure/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ impl AzureClient {
CredentialProvider::AccessKey(key) => {
Ok(AzureCredential::AccessKey(key.to_owned()))
}
CredentialProvider::ClientSecret(cred) => {
let token = cred
.fetch_token(&self.client, &self.config.retry_config)
CredentialProvider::TokenCredential(cache, cred) => {
let token = cache
.get_or_insert_with(|| {
cred.fetch_token(&self.client, &self.config.retry_config)
})
.await
.context(AuthorizationSnafu)?;
Ok(AzureCredential::AuthorizationToken(
Expand Down
Loading

0 comments on commit 73ce076

Please sign in to comment.