From 7d94193fb48e36075c4ee1aca63bb989002af470 Mon Sep 17 00:00:00 2001 From: asafmahlev Date: Sun, 18 Aug 2024 10:37:37 +0300 Subject: [PATCH] Fixed imports --- azure-kusto-data/src/authorization_policy.rs | 2 +- azure-kusto-data/src/connection_string.rs | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/azure-kusto-data/src/authorization_policy.rs b/azure-kusto-data/src/authorization_policy.rs index 472c8fe..5fb9dfd 100644 --- a/azure-kusto-data/src/authorization_policy.rs +++ b/azure-kusto-data/src/authorization_policy.rs @@ -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(), )); diff --git a/azure-kusto-data/src/connection_string.rs b/azure-kusto-data/src/connection_string.rs index 5c6b033..373286a 100644 --- a/azure-kusto-data/src/connection_string.rs +++ b/azure-kusto-data/src/connection_string.rs @@ -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; @@ -346,7 +344,7 @@ impl ConnectionStringAuth { } } - pub(crate) fn into_credential(self) -> Arc { + pub(crate) fn into_credential(self, cloud_info: &CloudInfo) -> Arc { match self { ConnectionStringAuth::Default => Arc::new(DefaultAzureCredential::default()), ConnectionStringAuth::UserAndPassword { .. } => unimplemented!(), @@ -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()),