You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/08/26 09:38:20 UTC
(opendal) branch main updated: feat(services/azdls): support custom credential providers (#8030)
This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new fa7e0b3b8 feat(services/azdls): support custom credential providers (#8030)
fa7e0b3b8 is described below
commit fa7e0b3b88a45b3ca07b28332f1af1dc2fdd57dc
Author: Zakariya Stasa <za...@gmail.com>
AuthorDate: Wed Aug 26 10:38:14 2026 +0100
feat(services/azdls): support custom credential providers (#8030)
* feat(services/azdls): support custom credential providers
* refactor(services/azdls): expose only provider chains
---
core/services/azdls/src/backend.rs | 28 +++++++++++++++++++++-------
core/services/azdls/src/config.rs | 5 ++++-
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/core/services/azdls/src/backend.rs b/core/services/azdls/src/backend.rs
index 011541188..287a03081 100644
--- a/core/services/azdls/src/backend.rs
+++ b/core/services/azdls/src/backend.rs
@@ -20,12 +20,14 @@ use std::sync::Arc;
use http::StatusCode;
use log::debug;
+use reqsign_azure_storage::Credential;
use reqsign_azure_storage::DefaultCredentialProvider;
use reqsign_azure_storage::RequestSigner;
use reqsign_azure_storage::StaticCredentialProvider;
use reqsign_core::Context;
use reqsign_core::Env as _;
use reqsign_core::OsEnv;
+use reqsign_core::ProvideCredentialChain;
use reqsign_core::Signer;
use reqsign_core::StaticEnv;
use reqsign_file_read_tokio::TokioFileRead;
@@ -69,6 +71,7 @@ impl From<AzureConnectionConfig> for AzdlsConfig {
#[derive(Default)]
pub struct AzdlsBuilder {
pub(super) config: AzdlsConfig,
+ pub(super) credential_providers: Option<ProvideCredentialChain<Credential>>,
}
impl Debug for AzdlsBuilder {
@@ -187,6 +190,12 @@ impl AzdlsBuilder {
self
}
+ /// Replace the credential providers with a custom chain.
+ pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
+ self.credential_providers = Some(chain);
+ self
+ }
+
/// Set authority_host of this backend.
///
/// - If authority_host is set, we will take user's input first.
@@ -300,22 +309,27 @@ impl Builder for AzdlsBuilder {
envs,
});
- let mut credential = DefaultCredentialProvider::new();
+ let mut credential_providers =
+ ProvideCredentialChain::new().push(DefaultCredentialProvider::new());
if let (Some(account_name), Some(account_key)) =
(account_name.as_deref(), self.config.account_key.as_deref())
{
- credential = credential.push_front(StaticCredentialProvider::new_shared_key(
- account_name,
- account_key,
- ));
+ credential_providers = credential_providers.push_front(
+ StaticCredentialProvider::new_shared_key(account_name, account_key),
+ );
}
if let Some(sas_token) = self.config.sas_token.as_deref() {
- credential = credential.push_front(StaticCredentialProvider::new_sas_token(sas_token));
+ credential_providers =
+ credential_providers.push_front(StaticCredentialProvider::new_sas_token(sas_token));
+ }
+
+ if let Some(customized_credential_chain) = self.credential_providers {
+ credential_providers = customized_credential_chain;
}
let sign_ctx = ctx;
- let signer = Signer::new(sign_ctx.clone(), credential, RequestSigner::new());
+ let signer = Signer::new(sign_ctx.clone(), credential_providers, RequestSigner::new());
let info = ServiceInfo::new(AZDLS_SCHEME, &root, filesystem);
let capability = Capability {
diff --git a/core/services/azdls/src/config.rs b/core/services/azdls/src/config.rs
index b2b805132..cfaffdaa1 100644
--- a/core/services/azdls/src/config.rs
+++ b/core/services/azdls/src/config.rs
@@ -124,7 +124,10 @@ impl opendal_core::Configurator for AzdlsConfig {
#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
- AzdlsBuilder { config: self }
+ AzdlsBuilder {
+ config: self,
+ credential_providers: None,
+ }
}
}