-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add content type support on rename file. (#4712) * Storage/STG74 Bearer Challenge (#4743) * bearer challenge * Storage/STG78 OAuth Copy (#4831) * OAuth Copy * add test for oauth copy * add test * fix conversation * fix conversation * update clang format * update test record * update test case * fix unit test cases * update recordings * recordings * fff * fix doc * CL * recording * fix typo * CL * recording * revert debug code --------- Co-authored-by: Jinming Hu <[email protected]>
- Loading branch information
1 parent
b8d2301
commit 69e5f1a
Showing
39 changed files
with
622 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
sdk/storage/azure-storage-blobs/test/ut/bearer_token_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include "block_blob_client_test.hpp" | ||
|
||
namespace Azure { namespace Storage { namespace Test { | ||
|
||
TEST_F(BlockBlobClientTest, ClientSecretCredentialWorks) | ||
{ | ||
const std::string containerName = LowercaseRandomString(); | ||
auto containerClient = Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( | ||
StandardStorageConnectionString(), containerName); | ||
auto credential = std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
AadTenantId(), | ||
AadClientId(), | ||
AadClientSecret(), | ||
InitStorageClientOptions<Core::Credentials::TokenCredentialOptions>()); | ||
containerClient = Blobs::BlobContainerClient( | ||
containerClient.GetUrl(), credential, InitStorageClientOptions<Blobs::BlobClientOptions>()); | ||
|
||
EXPECT_NO_THROW(containerClient.Create()); | ||
EXPECT_NO_THROW(containerClient.Delete()); | ||
} | ||
|
||
TEST_F(BlockBlobClientTest, BearerChallengeWorks) | ||
{ | ||
Blobs::BlobClientOptions clientOptions | ||
= InitStorageClientOptions<Azure::Storage::Blobs::BlobClientOptions>(); | ||
auto options = InitStorageClientOptions<Azure::Identity::ClientSecretCredentialOptions>(); | ||
|
||
// With tenantId | ||
clientOptions.EnableTenantDiscovery = true; | ||
options.AdditionallyAllowedTenants = {"*"}; | ||
auto blobClient = Blobs::BlobClient( | ||
m_blockBlobClient->GetUrl(), | ||
std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
AadTenantId(), AadClientId(), AadClientSecret(), options), | ||
clientOptions); | ||
EXPECT_NO_THROW(blobClient.GetProperties()); | ||
EXPECT_NO_THROW(ReadBodyStream(blobClient.Download().Value.BodyStream)); | ||
|
||
// Without tenantId | ||
clientOptions.EnableTenantDiscovery = true; | ||
options.AdditionallyAllowedTenants = {"*"}; | ||
blobClient = Blobs::BlobClient( | ||
m_blockBlobClient->GetUrl(), | ||
std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
"", AadClientId(), AadClientSecret(), options), | ||
clientOptions); | ||
EXPECT_NO_THROW(blobClient.GetProperties()); | ||
|
||
// With error tenantId | ||
clientOptions.EnableTenantDiscovery = true; | ||
options.AdditionallyAllowedTenants = {"*"}; | ||
blobClient = Blobs::BlobClient( | ||
m_blockBlobClient->GetUrl(), | ||
std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
"test", AadClientId(), AadClientSecret(), options), | ||
clientOptions); | ||
EXPECT_NO_THROW(blobClient.GetProperties()); | ||
|
||
// Disable Tenant Discovery and without tenantId | ||
clientOptions.EnableTenantDiscovery = false; | ||
blobClient = Blobs::BlobClient( | ||
m_blockBlobClient->GetUrl(), | ||
std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
"", AadClientId(), AadClientSecret(), options), | ||
clientOptions); | ||
EXPECT_THROW(blobClient.GetProperties(), Azure::Core::Credentials::AuthenticationException); | ||
|
||
// Don't allow additional tenants | ||
clientOptions.EnableTenantDiscovery = true; | ||
options.AdditionallyAllowedTenants = {}; | ||
blobClient = Blobs::BlobClient( | ||
m_blockBlobClient->GetUrl(), | ||
std::make_shared<Azure::Identity::ClientSecretCredential>( | ||
"", AadClientId(), AadClientSecret(), options), | ||
clientOptions); | ||
EXPECT_THROW(blobClient.GetProperties(), Azure::Core::Credentials::AuthenticationException); | ||
} | ||
|
||
}}} // namespace Azure::Storage::Test |
Oops, something went wrong.