Skip to content

Commit

Permalink
Fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
AsafMah committed Aug 18, 2024
1 parent 544623f commit 7d94193
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion azure-kusto-data/src/authorization_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Policy for AuthorizationPolicy {
.unwrap_or_default();

*lock = Some((
self.auth.clone().into_credential(),
self.auth.clone().into_credential(&cloud_info),
cloud_info.get_resource_uri().to_string(),
));

Expand Down
16 changes: 7 additions & 9 deletions azure-kusto-data/src/connection_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ use std::time::Duration;
use crate::client_details;
use crate::client_details::{ClientDetails, ConnectorDetails};
use azure_core::auth::TokenCredential;
use azure_identity::{
AzureCliCredential, ClientSecretCredential, DefaultAzureCredential,
ImdsManagedIdentityCredential, TokenCredentialOptions,
};
use azure_core::Url;
use azure_identity::{AppServiceManagedIdentityCredential, AzureCliCredential, ClientSecretCredential, DefaultAzureCredential};
use hashbrown::HashMap;
use once_cell::sync::Lazy;

use crate::cloud_info::CloudInfo;
use crate::credentials::{CallbackTokenCredential, ConstTokenCredential};
use crate::error::ConnectionStringError;

Expand Down Expand Up @@ -346,7 +344,7 @@ impl ConnectionStringAuth {
}
}

pub(crate) fn into_credential(self) -> Arc<dyn TokenCredential> {
pub(crate) fn into_credential(self, cloud_info: &CloudInfo) -> Arc<dyn TokenCredential> {
match self {
ConnectionStringAuth::Default => Arc::new(DefaultAzureCredential::default()),
ConnectionStringAuth::UserAndPassword { .. } => unimplemented!(),
Expand All @@ -364,17 +362,17 @@ impl ConnectionStringAuth {
client_authority,
} => Arc::new(ClientSecretCredential::new(
azure_core::new_http_client(),
Url::parse(cloud_info.login_endpoint.as_ref()).expect("Invalid login endpoint"),
client_authority,
client_id,
client_secret,
TokenCredentialOptions::default(),
)),
ConnectionStringAuth::ApplicationCertificate { .. } => unimplemented!(),
ConnectionStringAuth::ManagedIdentity { user_id } => {
if let Some(user_id) = user_id {
Arc::new(ImdsManagedIdentityCredential::default().with_object_id(user_id))
Arc::new(AppServiceManagedIdentityCredential::default().with_object_id(user_id))
} else {
Arc::new(ImdsManagedIdentityCredential::default())
Arc::new(AppServiceManagedIdentityCredential::default())
}
}
ConnectionStringAuth::AzureCli => Arc::new(AzureCliCredential::default()),
Expand Down

0 comments on commit 7d94193

Please sign in to comment.