-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-39449: [C++] Use default Azure credentials implicitly and support anonymous credentials explicitly #39450
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
Changes from all commits
fdf5931
3e2adff
ea37431
90d457d
32d1690
3460eb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,8 +47,23 @@ namespace arrow::fs { | |
| class TestAzureFileSystem; | ||
|
|
||
| /// Options for the AzureFileSystem implementation. | ||
| /// | ||
| /// By default, authentication is handled by the Azure SDK's credential chain | ||
| /// which may read from multiple environment variables, such as: | ||
| /// - `AZURE_TENANT_ID` | ||
| /// - `AZURE_CLIENT_ID` | ||
| /// - `AZURE_CLIENT_SECRET` | ||
| /// - `AZURE_AUTHORITY_HOST` | ||
| /// - `AZURE_CLIENT_CERTIFICATE_PATH` | ||
| /// - `AZURE_FEDERATED_TOKEN_FILE` | ||
| /// | ||
| /// Functions are provided for explicit configuration of credentials if that is preferred. | ||
| struct ARROW_EXPORT AzureOptions { | ||
| /// \brief account name of the Azure Storage account. | ||
| /// \brief The name of the Azure Storage Account being accessed. | ||
| /// | ||
| /// All service URLs will be constructed using this storage account name. | ||
| /// `ConfigureAccountKeyCredential` assumes the user wants to authenticate | ||
| /// this account. | ||
| std::string account_name; | ||
|
|
||
| /// \brief hostname[:port] of the Azure Blob Storage Service. | ||
|
|
@@ -92,30 +107,30 @@ struct ARROW_EXPORT AzureOptions { | |
|
|
||
| private: | ||
| enum class CredentialKind { | ||
| kDefault, | ||
| kAnonymous, | ||
| kTokenCredential, | ||
| kStorageSharedKeyCredential, | ||
| } credential_kind_ = CredentialKind::kAnonymous; | ||
| kStorageSharedKey, | ||
| kClientSecret, | ||
| kManagedIdentity, | ||
| kWorkloadIdentity, | ||
| } credential_kind_ = CredentialKind::kDefault; | ||
|
|
||
| std::shared_ptr<Azure::Core::Credentials::TokenCredential> token_credential_; | ||
| std::shared_ptr<Azure::Storage::StorageSharedKeyCredential> | ||
| storage_shared_key_credential_; | ||
| mutable std::shared_ptr<Azure::Core::Credentials::TokenCredential> token_credential_; | ||
|
||
|
|
||
| public: | ||
| AzureOptions(); | ||
| ~AzureOptions(); | ||
|
|
||
| Status ConfigureDefaultCredential(); | ||
|
|
||
| Status ConfigureManagedIdentityCredential(const std::string& client_id = std::string()); | ||
|
|
||
| Status ConfigureWorkloadIdentityCredential(); | ||
|
|
||
| Status ConfigureAnonymousCredential(); | ||
| Status ConfigureAccountKeyCredential(const std::string& account_key); | ||
|
|
||
| Status ConfigureClientSecretCredential(const std::string& tenant_id, | ||
| const std::string& client_id, | ||
| const std::string& client_secret); | ||
| Status ConfigureManagedIdentityCredential(const std::string& client_id = std::string()); | ||
| Status ConfigureWorkloadIdentityCredential(); | ||
|
|
||
| bool Equals(const AzureOptions& other) const; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we really need to change this. I would rather just keep
kTokenCredentialto cover all the credentials that are based on https://github.com/Azure/azure-sdk-for-cpp/blob/e5e675440b44ace7d7a9e7bc303f877c06b59ea5/sdk/core/azure-core/inc/azure/core/credentials/credentials.hpp#L68Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this to support
Equals. Think of it as runtime type-information that describes which concrete implementation ofTokenCredentialis being used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that, we would need to make a distinction between
kDefaultand all the otherskTokenat least (to support the implicit default behavior). It's clearer if we then make a distinction on all of them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would have done it differently but I don't feel strongly.