diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3faa8fdaa..7e0ca94b5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,6 +16,9 @@ # Azure::Core /sdk/core/ @ahsonkhan @antkmsft @rickwinter @vhvb1989 +# Azure::Identity +/sdk/identity/ @antkmsft + # Service teams /sdk/storage/ @vinjiang @katmsft @JinmingHu-MSFT @antkmsft @rickwinter @vhvb1989 diff --git a/CMakeLists.txt b/CMakeLists.txt index 441ace5bc..a0ff4187a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,5 +66,7 @@ if(BUILD_TESTING) add_subdirectory(sdk/core/azure-core/test/e2e) endif() +add_subdirectory(sdk/identity/azure-identity) + add_subdirectory(sdk/storage) add_subdirectory(sdk/template/azure-template) diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index 9b260c92f..24957a008 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -24,8 +24,7 @@ endif() add_library ( ${TARGET_NAME} src/context.cpp - src/credentials/credentials.cpp - src/credentials/policy/policies.cpp + src/credentials.cpp src/datetime.cpp src/http/body_stream.cpp ${CURL_TRANSPORT_ADAPTER_SRC} diff --git a/sdk/core/azure-core/inc/azure/core/credentials/policy/policies.hpp b/sdk/core/azure-core/inc/azure/core/credentials.hpp similarity index 64% rename from sdk/core/azure-core/inc/azure/core/credentials/policy/policies.hpp rename to sdk/core/azure-core/inc/azure/core/credentials.hpp index f3fd1a951..9b9530b0a 100644 --- a/sdk/core/azure-core/inc/azure/core/credentials/policy/policies.hpp +++ b/sdk/core/azure-core/inc/azure/core/credentials.hpp @@ -3,19 +3,77 @@ /** * @file - * @brief Authentication policies. + * @brief Credentials used for authentication with many (not all) Azure SDK client libraries. */ #pragma once -#include "azure/core/credentials/credentials.hpp" -#include "azure/core/http/policy.hpp" +#include +#include + +#include #include #include +#include #include #include +#include -namespace Azure { namespace Core { namespace Credentials { namespace Policy { +namespace Azure { namespace Core { + + /** + * @brief Represents an access token. + */ + struct AccessToken + { + /** + * @brief Token string. + */ + std::string Token; + + /** + * @brief Token expiration. + */ + std::chrono::system_clock::time_point ExpiresOn; + }; + + /** + * @brief Token credential. + */ + class TokenCredential { + public: + /** + * @brief Get an authentication token. + * + * @param context #Context so that operation can be canceled. + * @param scopes Authentication scopes. + */ + virtual AccessToken GetToken(Context const& context, std::vector const& scopes) + const = 0; + + /// Destructor. + virtual ~TokenCredential() = default; + + protected: + TokenCredential() {} + + private: + TokenCredential(TokenCredential const&) = delete; + void operator=(TokenCredential const&) = delete; + }; + + /** + * @brief An exception that gets thrown when authentication error occurs. + */ + class AuthenticationException : public std::runtime_error { + public: + /** + * @brief Construct with message string. + * + * @param msg Message string. + */ + explicit AuthenticationException(std::string const& msg) : std::runtime_error(msg) {} + }; /** * @brief Bearer Token authentication policy. @@ -89,4 +147,4 @@ namespace Azure { namespace Core { namespace Credentials { namespace Policy { Http::NextHttpPolicy policy) const override; }; -}}}} // namespace Azure::Core::Credentials::Policy +}} // namespace Azure::Core diff --git a/sdk/core/azure-core/inc/azure/core/credentials/credentials.hpp b/sdk/core/azure-core/inc/azure/core/credentials/credentials.hpp deleted file mode 100644 index 833b56086..000000000 --- a/sdk/core/azure-core/inc/azure/core/credentials/credentials.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: MIT - -/** - * @file - * @brief Credentials used for authentication with many (not all) Azure SDK client libraries. - */ - -#pragma once - -#include "azure/core/context.hpp" - -#include -#include -#include -#include -#include -#include - -namespace Azure { namespace Core { namespace Credentials { - - /** - * @brief Represents an access token. - */ - struct AccessToken - { - /** - * @brief Token string. - */ - std::string Token; - - /** - * @brief Token expiration. - */ - std::chrono::system_clock::time_point ExpiresOn; - }; - - /** - * @brief Token credential. - */ - class TokenCredential { - public: - /** - * @brief Get an authentication token. - * - * @param context #Context so that operation can be canceled. - * @param scopes Authentication scopes. - */ - virtual AccessToken GetToken(Context const& context, std::vector const& scopes) - const = 0; - - /// Destructor. - virtual ~TokenCredential() = default; - - protected: - TokenCredential() {} - - private: - TokenCredential(TokenCredential const&) = delete; - void operator=(TokenCredential const&) = delete; - }; - - /** - * @brief This class is used by Azure SDK clients to authenticate with the Azure service using a - * tenant ID, client ID and client secret. - */ - class ClientSecretCredential : public TokenCredential { - private: - static std::string const g_aadGlobalAuthority; - - std::string m_tenantId; - std::string m_clientId; - std::string m_clientSecret; - std::string m_authority; - - public: - /** - * @brief Construct a Client Secret credential. - * - * @param tenantId Tenant ID. - * @param clientId Client ID. - * @param clientSecret Client Secret. - * @param authority Authentication authority URL to set. If omitted, initializes credential with - * default authority (Azure AD global authority - "https://login.microsoftonline.com/"). - * - * @note Example of a \p authority string: "https://login.microsoftonline.us/". See national - * clouds' Azure AD authentication endpoints: - * https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-national-cloud. - */ - explicit ClientSecretCredential( - std::string tenantId, - std::string clientId, - std::string clientSecret, - std::string authority = g_aadGlobalAuthority) - : m_tenantId(std::move(tenantId)), m_clientId(std::move(clientId)), - m_clientSecret(std::move(clientSecret)), m_authority(std::move(authority)) - { - } - - AccessToken GetToken(Context const& context, std::vector const& scopes) - const override; - }; - - /** - * @brief An exception that gets thrown when authentication error occurs. - */ - class AuthenticationException : public std::runtime_error { - public: - explicit AuthenticationException(std::string const& msg) : std::runtime_error(msg) {} - }; - - /** - * @brief An environment credential. - */ - class EnvironmentCredential : public TokenCredential { - std::unique_ptr m_credentialImpl; - - public: - /** - * Constructs an environment credential. - */ - explicit EnvironmentCredential(); - - AccessToken GetToken(Context const& context, std::vector const& scopes) - const override; - }; - -}}} // namespace Azure::Core::Credentials diff --git a/sdk/core/azure-core/inc/azure/core/version.hpp b/sdk/core/azure-core/inc/azure/core/version.hpp index bac9e6d86..298375675 100644 --- a/sdk/core/azure-core/inc/azure/core/version.hpp +++ b/sdk/core/azure-core/inc/azure/core/version.hpp @@ -38,7 +38,7 @@ namespace Azure { namespace Core { * @brief The version in string format used for telemetry following the `semver.org` standard * (https://semver.org). */ - static std::string const VersionString(); + static std::string VersionString(); private: // To avoid leaking out the #define values we smuggle out the value @@ -52,5 +52,3 @@ namespace Azure { namespace Core { #undef AZURE_CORE_VERSION_MINOR #undef AZURE_CORE_VERSION_PATCH #undef AZURE_CORE_VERSION_PRERELEASE - - diff --git a/sdk/core/azure-core/src/credentials/policy/policies.cpp b/sdk/core/azure-core/src/credentials.cpp similarity index 73% rename from sdk/core/azure-core/src/credentials/policy/policies.cpp rename to sdk/core/azure-core/src/credentials.cpp index 4f924fa0a..75575238b 100644 --- a/sdk/core/azure-core/src/credentials/policy/policies.cpp +++ b/sdk/core/azure-core/src/credentials.cpp @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT -#include "azure/core/credentials/policy/policies.hpp" +#include -using namespace Azure::Core::Credentials::Policy; +using namespace Azure::Core; -std::unique_ptr BearerTokenAuthenticationPolicy::Send( +std::unique_ptr BearerTokenAuthenticationPolicy::Send( Context const& context, Http::Request& request, Http::NextHttpPolicy policy) const diff --git a/sdk/core/azure-core/src/version.cpp b/sdk/core/azure-core/src/version.cpp index 16828daaa..89ea1305b 100644 --- a/sdk/core/azure-core/src/version.cpp +++ b/sdk/core/azure-core/src/version.cpp @@ -3,28 +3,27 @@ #include "azure/core/version.hpp" -#include #include +#include using namespace Azure::Core; const std::string Version::PreRelease = secret; -std::string const Version::VersionString() +std::string Version::VersionString() { static const std::string versionString = [] { - std::string version; - std::stringstream ss; - std::string dot = "."; + std::string version; + std::stringstream ss; + std::string dot = "."; - ss << Version::Major << dot << Version::Minor << dot << Version::Patch; + ss << Version::Major << dot << Version::Minor << dot << Version::Patch; - if (!Version::PreRelease.empty()) - ss << "-" << Version::PreRelease; + if (!Version::PreRelease.empty()) + ss << "-" << Version::PreRelease; - return ss.str(); + return ss.str(); }(); return versionString; } - diff --git a/sdk/identity/CHANGELOG.md b/sdk/identity/CHANGELOG.md new file mode 100644 index 000000000..e2846af38 --- /dev/null +++ b/sdk/identity/CHANGELOG.md @@ -0,0 +1,6 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +* Support for Client Secret Credential +* Support for Environment Credential diff --git a/sdk/identity/CMakeLists.txt b/sdk/identity/CMakeLists.txt new file mode 100644 index 000000000..3a72a6011 --- /dev/null +++ b/sdk/identity/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT + +cmake_minimum_required (VERSION 3.12) + +project (azure-identity LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +add_subdirectory(azure-identity) diff --git a/sdk/identity/azure-identity/CMakeLists.txt b/sdk/identity/azure-identity/CMakeLists.txt new file mode 100644 index 000000000..296eb59df --- /dev/null +++ b/sdk/identity/azure-identity/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT + +cmake_minimum_required (VERSION 3.12) + +set (AZURE_IDENTITY_HEADER + inc/azure/identity/client_secret_credential.hpp + inc/azure/identity/environment_credential.hpp + inc/azure/identity/version.hpp +) + +set (AZURE_IDENTITY_SOURCE + src/client_secret_credential.cpp + src/environment_credential.cpp + src/version.cpp +) + +add_library(azure-identity ${AZURE_IDENTITY_HEADER} ${AZURE_IDENTITY_SOURCE}) +target_include_directories(azure-identity PUBLIC inc) +target_link_libraries(azure-identity azure-core) + +add_library(azure::identity ALIAS azure-identity) + +get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/identity/version.hpp") +generate_documentation(azure-identity ${AZ_LIBRARY_VERSION}) diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md new file mode 100644 index 000000000..c70fb84ef --- /dev/null +++ b/sdk/identity/azure-identity/README.md @@ -0,0 +1,73 @@ +# Azure SDK Identity Library for C++ + +Azure::Identity (`azure-identity`) provides shared primitives, abstractions, and helpers for modern Azure SDK client libraries written in the C++. These libraries follow the [Azure SDK Design Guidelines for C++][azure_sdk_cpp_development_guidelines]. + +The library contains commonly (but not universally) used credential types. + +## Getting started + +Typically, you will not need to download `azure-identity`; it will be downloaded for you as a dependency of the client libraries. In case you want to download it explicitly (to implement your own client library, for example), you can find the source +in here. + +## Key concepts + +Azure::Identity credentials: +- Client Secret Credential (`ClientSecretCredential`) +- Environment Credential (`EnvironmentCredential`) + +## Troubleshooting + +Three main ways of troubleshooting failures are: +- Inspecting exceptions +- Enabling logging (`Available in future release`) +- Distributed tracing (`Available in future release`) + +## Next steps + +Explore and install available Azure SDK libraries. + +## Contributing +For details on contributing to this repository, see the [contributing guide][azure_sdk_for_cpp_contributing]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +### Additional Helpful Links for Contributors +Many people all over the world have helped make this project better. You'll want to check out: + +* [What are some good first issues for new contributors to the repo?](https://github.com/azure/azure-sdk-for-cpp/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22) +* [How to build and test your change][azure_sdk_for_cpp_contributing_developer_guide] +* [How you can make a change happen!][azure_sdk_for_cpp_contributing_pull_requests] +* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for C++ wiki](https://github.com/azure/azure-sdk-for-cpp/wiki). + + +### Reporting security issues and security bugs + +Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) . You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). + +### License + +Azure SDK for C++ is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-cpp/blob/master/sdk/core/azure-core/LICENSE) license. + + +[azure_sdk_for_cpp_contributing]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md +[azure_sdk_for_cpp_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#developer-guide +[azure_sdk_for_cpp_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests +[azure_sdk_cpp_development_guidelines]: https://azure.github.io/azure-sdk/cpp_introduction.html +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_pattern_circuit_breaker]: https://docs.microsoft.com/azure/architecture/patterns/circuit-breaker +[azure_pattern_retry]: https://docs.microsoft.com/azure/architecture/patterns/retry +[azure_portal]: https://portal.azure.com +[azure_sub]: https://azure.microsoft.com/free/ +[c_compiler]: https://visualstudio.microsoft.com/vs/features/cplusplus/ +[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview +[cloud_shell_bash]: https://shell.azure.com/bash diff --git a/sdk/identity/azure-identity/inc/azure/identity/client_secret_credential.hpp b/sdk/identity/azure-identity/inc/azure/identity/client_secret_credential.hpp new file mode 100644 index 000000000..ed8c32a0b --- /dev/null +++ b/sdk/identity/azure-identity/inc/azure/identity/client_secret_credential.hpp @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +/** + * @file + * @brief Client Secret Credential. + */ + +#pragma once + +#include + +#include +#include + +namespace Azure { namespace Identity { + + /** + * @brief This class is used by Azure SDK clients to authenticate with the Azure service using a + * tenant ID, client ID and client secret. + */ + class ClientSecretCredential : public Core::TokenCredential { + private: + static std::string const g_aadGlobalAuthority; + + std::string m_tenantId; + std::string m_clientId; + std::string m_clientSecret; + std::string m_authority; + + public: + /** + * @brief Construct a Client Secret credential. + * + * @param tenantId Tenant ID. + * @param clientId Client ID. + * @param clientSecret Client Secret. + * @param authority Authentication authority URL to set. If omitted, initializes credential with + * default authority (Azure AD global authority - "https://login.microsoftonline.com/"). + * + * @note Example of a \p authority string: "https://login.microsoftonline.us/". See national + * clouds' Azure AD authentication endpoints: + * https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-national-cloud. + */ + explicit ClientSecretCredential( + std::string tenantId, + std::string clientId, + std::string clientSecret, + std::string authority = g_aadGlobalAuthority) + : m_tenantId(std::move(tenantId)), m_clientId(std::move(clientId)), + m_clientSecret(std::move(clientSecret)), m_authority(std::move(authority)) + { + } + + Core::AccessToken GetToken(Core::Context const& context, std::vector const& scopes) + const override; + }; + +}} // namespace Azure::Identity diff --git a/sdk/identity/azure-identity/inc/azure/identity/environment_credential.hpp b/sdk/identity/azure-identity/inc/azure/identity/environment_credential.hpp new file mode 100644 index 000000000..8e9554a33 --- /dev/null +++ b/sdk/identity/azure-identity/inc/azure/identity/environment_credential.hpp @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +/** + * @file + * @brief Environment Credential. + */ + +#pragma once + +#include + +#include + +namespace Azure { namespace Identity { + + /** + * @brief An environment credential. + */ + class EnvironmentCredential : public Core::TokenCredential { + std::unique_ptr m_credentialImpl; + + public: + /** + * Constructs an environment credential. + */ + explicit EnvironmentCredential(); + + Core::AccessToken GetToken(Core::Context const& context, std::vector const& scopes) + const override; + }; + +}} // namespace Azure::Identity diff --git a/sdk/identity/azure-identity/inc/azure/identity/version.hpp b/sdk/identity/azure-identity/inc/azure/identity/version.hpp new file mode 100644 index 000000000..beebcf078 --- /dev/null +++ b/sdk/identity/azure-identity/inc/azure/identity/version.hpp @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +/** + * @file + * @brief Provides version information. + */ + +#pragma once + +#include + +#define AZURE_IDENTITY_VERSION_MAJOR 1 +#define AZURE_IDENTITY_VERSION_MINOR 0 +#define AZURE_IDENTITY_VERSION_PATCH 0 +#define AZURE_IDENTITY_VERSION_PRERELEASE "beta.1" + +namespace Azure { namespace Identity { + + /** + * @brief Provides version information. + */ + class Version { + public: + /// Major numeric identifier. + static constexpr int Major = AZURE_IDENTITY_VERSION_MAJOR; + + /// Minor numeric identifier. + static constexpr int Minor = AZURE_IDENTITY_VERSION_MINOR; + + /// Patch numeric identifier. + static constexpr int Patch = AZURE_IDENTITY_VERSION_PATCH; + + /// Optional pre-release identifier. SDK is in a pre-release state when not empty. + static std::string const PreRelease; + + /** + * @brief The version in string format used for telemetry following the `semver.org` standard + * (https://semver.org). + */ + static std::string VersionString(); + + private: + // To avoid leaking out the #define values we smuggle out the value + // which will later be used to initialize the PreRelease std::string + static constexpr char const* secret = AZURE_IDENTITY_VERSION_PRERELEASE; + }; + +}} // namespace Azure::Identity + +#undef AZURE_IDENTITY_VERSION_MAJOR +#undef AZURE_IDENTITY_VERSION_MINOR +#undef AZURE_IDENTITY_VERSION_PATCH +#undef AZURE_IDENTITY_VERSION_PRERELEASE diff --git a/sdk/core/azure-core/src/credentials/credentials.cpp b/sdk/identity/azure-identity/src/client_secret_credential.cpp similarity index 57% rename from sdk/core/azure-core/src/credentials/credentials.cpp rename to sdk/identity/azure-identity/src/client_secret_credential.cpp index 6fa8f4730..e6a12ba93 100644 --- a/sdk/core/azure-core/src/credentials/credentials.cpp +++ b/sdk/identity/azure-identity/src/client_secret_credential.cpp @@ -1,18 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT -#include "azure/core/credentials/credentials.hpp" -#include "azure/core/http/body_stream.hpp" -#include "azure/core/http/curl/curl.hpp" -#include "azure/core/http/http.hpp" -#include "azure/core/http/pipeline.hpp" +#include + +#include +#include -#include #include #include -#include -using namespace Azure::Core::Credentials; +using namespace Azure::Identity; namespace { std::string UrlEncode(std::string const& s) @@ -39,17 +36,20 @@ std::string UrlEncode(std::string const& s) } } // namespace -std::string const Azure::Core::Credentials::ClientSecretCredential::g_aadGlobalAuthority +std::string const ClientSecretCredential::g_aadGlobalAuthority = "https://login.microsoftonline.com/"; -AccessToken Azure::Core::Credentials::ClientSecretCredential::GetToken( - Context const& context, +Azure::Core::AccessToken ClientSecretCredential::GetToken( + Azure::Core::Context const& context, std::vector const& scopes) const { + using namespace Azure::Core; + using namespace Azure::Core::Http; + static std::string const errorMsgPrefix("ClientSecretCredential::GetToken: "); try { - Http::Url url(m_authority); + Url url(m_authority); url.AppendPath(m_tenantId); url.AppendPath("oauth2/v2.0/token"); @@ -72,27 +72,27 @@ AccessToken Azure::Core::Credentials::ClientSecretCredential::GetToken( auto const bodyString = body.str(); auto bodyStream - = std::make_unique((uint8_t*)bodyString.data(), bodyString.size()); + = std::make_unique((uint8_t*)bodyString.data(), bodyString.size()); - Http::Request request(Http::HttpMethod::Post, url, bodyStream.get()); + Request request(HttpMethod::Post, url, bodyStream.get()); bodyStream.release(); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddHeader("Content-Length", std::to_string(bodyString.size())); - std::shared_ptr transport = std::make_unique(); + std::shared_ptr transport = std::make_unique(); - std::vector> policies; - policies.push_back(std::make_unique()); + std::vector> policies; + policies.push_back(std::make_unique()); - Http::RetryOptions retryOptions; - policies.push_back(std::make_unique(retryOptions)); + RetryOptions retryOptions; + policies.push_back(std::make_unique(retryOptions)); - policies.push_back(std::make_unique(std::move(transport))); + policies.push_back(std::make_unique(std::move(transport))); - Http::HttpPipeline httpPipeline(policies); + HttpPipeline httpPipeline(policies); - std::shared_ptr response = httpPipeline.Send(context, request); + std::shared_ptr response = httpPipeline.Send(context, request); if (!response) { @@ -100,11 +100,11 @@ AccessToken Azure::Core::Credentials::ClientSecretCredential::GetToken( } auto const statusCode = response->GetStatusCode(); - if (statusCode != Http::HttpStatusCode::Ok) + if (statusCode != HttpStatusCode::Ok) { std::ostringstream errorMsg; errorMsg << errorMsgPrefix << "error response: " - << static_cast::type>(statusCode) << " " + << static_cast::type>(statusCode) << " " << response->GetReasonPhrase(); throw AuthenticationException(errorMsg.str()); @@ -200,68 +200,3 @@ AccessToken Azure::Core::Credentials::ClientSecretCredential::GetToken( throw AuthenticationException("unknown error"); } } - -Azure::Core::Credentials::EnvironmentCredential::EnvironmentCredential() -{ -#ifdef _MSC_VER -#pragma warning(push) -// warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s -// instead. -#pragma warning(disable : 4996) -#endif - - auto tenantId = std::getenv("AZURE_TENANT_ID"); - auto clientId = std::getenv("AZURE_CLIENT_ID"); - - auto clientSecret = std::getenv("AZURE_CLIENT_SECRET"); - auto authority = std::getenv("AZURE_AUTHORITY_HOST"); - - // auto username = std::getenv("AZURE_USERNAME"); - // auto password = std::getenv("AZURE_PASSWORD"); - // - // auto clientCertificatePath = std::getenv("AZURE_CLIENT_CERTIFICATE_PATH"); - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - if (tenantId != nullptr && clientId != nullptr) - { - if (clientSecret != nullptr) - { - if (authority != nullptr) - { - m_credentialImpl.reset( - new ClientSecretCredential(tenantId, clientId, clientSecret, authority)); - } - else - { - m_credentialImpl.reset(new ClientSecretCredential(tenantId, clientId, clientSecret)); - } - } - // TODO: These credential types are not implemented. Uncomment when implemented. - // else if (username != nullptr && password != nullptr) - //{ - // m_credentialImpl.reset( - // new UsernamePasswordCredential(username, password, tenantId, clientId)); - //} - // else if (clientCertificatePath != nullptr) - //{ - // m_credentialImpl.reset( - // new ClientCertificateCredential(tenantId, clientId, clientCertificatePath)); - //} - } -} - -AccessToken Azure::Core::Credentials::EnvironmentCredential::GetToken( - Context const& context, - std::vector const& scopes) const -{ - if (!m_credentialImpl) - { - throw AuthenticationException("EnvironmentCredential authentication unavailable. " - "Environment variables are not fully configured."); - } - - return m_credentialImpl->GetToken(context, scopes); -} diff --git a/sdk/identity/azure-identity/src/environment_credential.cpp b/sdk/identity/azure-identity/src/environment_credential.cpp new file mode 100644 index 000000000..3b7e46245 --- /dev/null +++ b/sdk/identity/azure-identity/src/environment_credential.cpp @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +#include + +#include + +#include + +using namespace Azure::Identity; + +EnvironmentCredential::EnvironmentCredential() +{ +#ifdef _MSC_VER +#pragma warning(push) +// warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s +// instead. +#pragma warning(disable : 4996) +#endif + + auto tenantId = std::getenv("AZURE_TENANT_ID"); + auto clientId = std::getenv("AZURE_CLIENT_ID"); + + auto clientSecret = std::getenv("AZURE_CLIENT_SECRET"); + auto authority = std::getenv("AZURE_AUTHORITY_HOST"); + + // auto username = std::getenv("AZURE_USERNAME"); + // auto password = std::getenv("AZURE_PASSWORD"); + // + // auto clientCertificatePath = std::getenv("AZURE_CLIENT_CERTIFICATE_PATH"); + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + + if (tenantId != nullptr && clientId != nullptr) + { + if (clientSecret != nullptr) + { + if (authority != nullptr) + { + m_credentialImpl.reset( + new ClientSecretCredential(tenantId, clientId, clientSecret, authority)); + } + else + { + m_credentialImpl.reset(new ClientSecretCredential(tenantId, clientId, clientSecret)); + } + } + // TODO: These credential types are not implemented. Uncomment when implemented. + // else if (username != nullptr && password != nullptr) + //{ + // m_credentialImpl.reset( + // new UsernamePasswordCredential(username, password, tenantId, clientId)); + //} + // else if (clientCertificatePath != nullptr) + //{ + // m_credentialImpl.reset( + // new ClientCertificateCredential(tenantId, clientId, clientCertificatePath)); + //} + } +} + +Azure::Core::AccessToken EnvironmentCredential::GetToken( + Azure::Core::Context const& context, + std::vector const& scopes) const +{ + using namespace Azure::Core; + + if (!m_credentialImpl) + { + throw AuthenticationException("EnvironmentCredential authentication unavailable. " + "Environment variables are not fully configured."); + } + + return m_credentialImpl->GetToken(context, scopes); +} diff --git a/sdk/identity/azure-identity/src/version.cpp b/sdk/identity/azure-identity/src/version.cpp new file mode 100644 index 000000000..897e181de --- /dev/null +++ b/sdk/identity/azure-identity/src/version.cpp @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +#include "azure/identity/version.hpp" + +#include +#include + +using namespace Azure::Identity; + +std::string const Version::PreRelease = secret; + +std::string Version::VersionString() +{ + static const std::string versionString = [] { + std::string version; + std::stringstream ss; + std::string dot = "."; + + ss << Version::Major << dot << Version::Minor << dot << Version::Patch; + + if (!Version::PreRelease.empty()) + ss << "-" << Version::PreRelease; + + return ss.str(); + }(); + + return versionString; +} diff --git a/sdk/identity/ci.yml b/sdk/identity/ci.yml new file mode 100644 index 000000000..38ab26b65 --- /dev/null +++ b/sdk/identity/ci.yml @@ -0,0 +1,37 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - master + - feature/* + - release/* + - hotfix/* + paths: + include: + - eng/ + - CMakeLists.txt + - sdk/core + - sdk/identity + +pr: + branches: + include: + - master + - feature/* + - release/* + - hotfix/* + paths: + include: + - eng/ + - CMakeLists.txt + - sdk/core + - sdk/identity + +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: identity + CtestRegex: azure-identity + Artifacts: + - Name: azure-identity + Path: azure-identity diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/append_blob_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/append_blob_client.hpp index 94caacbc1..b20168650 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/append_blob_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/append_blob_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_client.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" @@ -68,7 +68,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit AppendBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const AppendBlobClientOptions& options = AppendBlobClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp index c9afec58c..803ffd2ff 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_batch_client.hpp @@ -121,7 +121,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobBatchClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobBatchClientOptions& options = BlobBatchClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_client.hpp index fb58e1ef9..43970d587 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/blob_responses.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" @@ -71,7 +71,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobClientOptions& options = BlobClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp index 6d0a893e8..148fb1845 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_client.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" @@ -64,7 +64,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobContainerClient( const std::string& containerUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobContainerClientOptions& options = BlobContainerClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp index af61c3b39..435a08ed9 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_service_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_container_client.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" @@ -56,7 +56,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlobServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobServiceClientOptions& options = BlobServiceClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/block_blob_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/block_blob_client.hpp index b15bd03ad..04c671115 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/block_blob_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/block_blob_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_client.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" @@ -78,7 +78,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit BlockBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlockBlobClientOptions& options = BlockBlobClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp index e7930d4d5..6f915aa95 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp @@ -3,7 +3,7 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_client.hpp" #include "azure/storage/blobs/blob_options.hpp" #include "azure/storage/blobs/blob_responses.hpp" @@ -70,7 +70,7 @@ namespace Azure { namespace Storage { namespace Blobs { */ explicit PageBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const PageBlobClientOptions& options = PageBlobClientOptions()); /** diff --git a/sdk/storage/azure-storage-blobs/src/append_blob_client.cpp b/sdk/storage/azure-storage-blobs/src/append_blob_client.cpp index 90c65ce45..aa3a62f25 100644 --- a/sdk/storage/azure-storage-blobs/src/append_blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/append_blob_client.cpp @@ -29,7 +29,7 @@ namespace Azure { namespace Storage { namespace Blobs { AppendBlobClient::AppendBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const AppendBlobClientOptions& options) : BlobClient(blobUri, std::move(credential), options) { diff --git a/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp index a82cca379..46abbc27e 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_batch_client.cpp @@ -7,7 +7,7 @@ #include #include -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/shared_key_policy.hpp" @@ -126,7 +126,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobBatchClient::BlobBatchClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobBatchClientOptions& options) : m_serviceUrl(serviceUri) { @@ -145,9 +145,8 @@ namespace Azure { namespace Storage { namespace Blobs { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); @@ -162,9 +161,8 @@ namespace Azure { namespace Storage { namespace Blobs { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Details::c_StorageScope)); policies.emplace_back(std::make_unique()); m_subRequestPipeline = std::make_shared(policies); } diff --git a/sdk/storage/azure-storage-blobs/src/blob_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_client.cpp index e390d4e76..e710b6def 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/blobs/blob_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/blobs/append_blob_client.hpp" #include "azure/storage/blobs/block_blob_client.hpp" @@ -68,7 +68,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobClient::BlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobClientOptions& options) : BlobClient(blobUri, options) { @@ -86,9 +86,8 @@ namespace Azure { namespace Storage { namespace Blobs { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp index a361add1a..97dcb6a08 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/blobs/blob_container_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/blobs/append_blob_client.hpp" #include "azure/storage/blobs/block_blob_client.hpp" @@ -64,7 +64,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobContainerClient::BlobContainerClient( const std::string& containerUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobContainerClientOptions& options) : BlobContainerClient(containerUri, options) { @@ -82,9 +82,8 @@ namespace Azure { namespace Storage { namespace Blobs { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp index 9874e62fd..cbb31e8c8 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_service_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/blobs/blob_service_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/shared_key_policy.hpp" @@ -59,7 +59,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlobServiceClient::BlobServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlobServiceClientOptions& options) : m_serviceUrl(serviceUri) { @@ -77,9 +77,8 @@ namespace Azure { namespace Storage { namespace Blobs { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-blobs/src/block_blob_client.cpp b/sdk/storage/azure-storage-blobs/src/block_blob_client.cpp index 69d38e318..05678dbdb 100644 --- a/sdk/storage/azure-storage-blobs/src/block_blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/block_blob_client.cpp @@ -32,7 +32,7 @@ namespace Azure { namespace Storage { namespace Blobs { BlockBlobClient::BlockBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const BlockBlobClientOptions& options) : BlobClient(blobUri, std::move(credential), options) { diff --git a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp index 964503869..c20036031 100644 --- a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Blobs { PageBlobClient::PageBlobClient( const std::string& blobUri, - std::shared_ptr credential, + std::shared_ptr credential, const PageBlobClientOptions& options) : BlobClient(blobUri, std::move(credential), options) { diff --git a/sdk/storage/azure-storage-blobs/test/blob_sas_test.cpp b/sdk/storage/azure-storage-blobs/test/blob_sas_test.cpp index 5111a554a..6a0c7d4f3 100644 --- a/sdk/storage/azure-storage-blobs/test/blob_sas_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/blob_sas_test.cpp @@ -45,7 +45,7 @@ namespace Azure { namespace Storage { namespace Test { auto blobServiceClient1 = Blobs::BlobServiceClient( serviceUri, - std::make_shared( + std::make_shared( AadTenantId(), AadClientId(), AadClientSecret())); auto userDelegationKey = *blobServiceClient1.GetUserDelegationKey( ToIso8601(std::chrono::system_clock::now() - std::chrono::minutes(5)), diff --git a/sdk/storage/azure-storage-common/CMakeLists.txt b/sdk/storage/azure-storage-common/CMakeLists.txt index 44fb8c5b5..c0ee54699 100644 --- a/sdk/storage/azure-storage-common/CMakeLists.txt +++ b/sdk/storage/azure-storage-common/CMakeLists.txt @@ -45,7 +45,7 @@ find_package(Threads REQUIRED) find_package(LibXml2 REQUIRED) target_include_directories(azure-storage-common PUBLIC inc ${LIBXML2_INCLUDE_DIR}) -target_link_libraries(azure-storage-common Threads::Threads azure-core ${LIBXML2_LIBRARIES}) +target_link_libraries(azure-storage-common Threads::Threads azure-core azure-identity ${LIBXML2_LIBRARIES}) if(MSVC) target_link_libraries(azure-storage-common bcrypt) # C28020 and C28204 are introduced by nlohmann/json diff --git a/sdk/storage/azure-storage-common/test/bearer_token_test.cpp b/sdk/storage/azure-storage-common/test/bearer_token_test.cpp index 2b1826d3a..0860f971d 100644 --- a/sdk/storage/azure-storage-common/test/bearer_token_test.cpp +++ b/sdk/storage/azure-storage-common/test/bearer_token_test.cpp @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT -#include "azure/core/credentials/credentials.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob.hpp" #include "test_base.hpp" @@ -13,7 +13,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_FALSE(AadClientId().empty() || AadClientSecret().empty() || AadTenantId().empty()); - auto credential = std::make_shared( + auto credential = std::make_shared( AadTenantId(), AadClientId(), AadClientSecret()); auto containerClient = Azure::Storage::Blobs::BlobContainerClient( diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp index abc59b48a..d8a4a1a6e 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_directory_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/datalake/datalake_options.hpp" #include "azure/storage/files/datalake/datalake_path_client.hpp" @@ -52,7 +52,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit DirectoryClient( const std::string& directoryUri, - std::shared_ptr credential, + std::shared_ptr credential, const DirectoryClientOptions& options = DirectoryClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp index da8dbfad6..2ab972edc 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/block_blob_client.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/datalake/datalake_options.hpp" @@ -53,7 +53,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit FileClient( const std::string& fileUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileClientOptions& options = FileClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp index a0d3d27f0..beb1df2f0 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_container_client.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/datalake/datalake_options.hpp" @@ -55,7 +55,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit FileSystemClient( const std::string& fileSystemUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileSystemClientOptions& options = FileSystemClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp index 6f311935e..ea8214a00 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_path_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_client.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/datalake/datalake_file_system_client.hpp" @@ -53,7 +53,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit PathClient( const std::string& pathUri, - std::shared_ptr credential, + std::shared_ptr credential, const PathClientOptions& options = PathClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp index e225a1734..116d8c992 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_service_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/blobs/blob_service_client.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/datalake/datalake_options.hpp" @@ -50,7 +50,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { */ explicit ServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const ServiceClientOptions& options = ServiceClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp index 4de080e18..a975adbb0 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_directory_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/datalake/datalake_directory_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/crypt.hpp" @@ -74,7 +74,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { DirectoryClient::DirectoryClient( const std::string& directoryUri, - std::shared_ptr credential, + std::shared_ptr credential, const DirectoryClientOptions& options) : PathClient(directoryUri, credential, options) { @@ -95,9 +95,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp index 5f65a2aa3..d7273e183 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/datalake/datalake_file_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/crypt.hpp" @@ -152,7 +152,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileClient::FileClient( const std::string& fileUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileClientOptions& options) : PathClient(fileUri, credential, options), m_blockBlobClient(m_blobClient.GetBlockBlobClient()) @@ -175,9 +175,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp index 2caa64505..d25d7b186 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/datalake/datalake_file_system_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" #include "azure/storage/common/constants.hpp" @@ -96,7 +96,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { FileSystemClient::FileSystemClient( const std::string& fileSystemUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileSystemClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(fileSystemUri)), m_blobContainerClient( @@ -122,9 +122,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp index eb6c286a6..e4a942052 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/datalake/datalake_path_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/crypt.hpp" @@ -136,7 +136,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { PathClient::PathClient( const std::string& pathUri, - std::shared_ptr credential, + std::shared_ptr credential, const PathClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(pathUri)), m_blobClient(Details::GetBlobUriFromUri(pathUri), credential, GetBlobClientOptions(options)) @@ -159,9 +159,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp index 387ff5c34..43b0c1901 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/datalake/datalake_service_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/blobs/protocol/blob_rest_client.hpp" #include "azure/storage/common/constants.hpp" @@ -103,7 +103,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { ServiceClient::ServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const ServiceClientOptions& options) : m_dfsUri(Details::GetDfsUriFromUri(serviceUri)), m_blobServiceClient( Details::GetBlobUriFromUri(serviceUri), @@ -127,9 +127,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-datalake/test/datalake_sas_test.cpp b/sdk/storage/azure-storage-files-datalake/test/datalake_sas_test.cpp index e15e9866a..9e5555bac 100644 --- a/sdk/storage/azure-storage-files-datalake/test/datalake_sas_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/datalake_sas_test.cpp @@ -52,7 +52,7 @@ namespace Azure { namespace Storage { namespace Test { auto serviceClient1 = Files::DataLake::ServiceClient( serviceUri, - std::make_shared( + std::make_shared( AadTenantId(), AadClientId(), AadClientSecret())); auto userDelegationKey = *serviceClient1.GetUserDelegationKey( ToIso8601(std::chrono::system_clock::now() - std::chrono::minutes(5)), diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index dd6231d3e..7456f9d56 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/shares/protocol/share_rest_client.hpp" #include "azure/storage/files/shares/share_options.hpp" @@ -53,7 +53,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit ShareClient( const std::string& shareUri, - std::shared_ptr credential, + std::shared_ptr credential, const ShareClientOptions& options = ShareClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp index c940aab03..23ac446b9 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/shares/protocol/share_rest_client.hpp" #include "azure/storage/files/shares/share_client.hpp" @@ -55,7 +55,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit DirectoryClient( const std::string& shareDirectoryUri, - std::shared_ptr credential, + std::shared_ptr credential, const DirectoryClientOptions& options = DirectoryClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp index 506ce544d..c640311a5 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/shares/protocol/share_rest_client.hpp" #include "azure/storage/files/shares/share_client.hpp" @@ -54,7 +54,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit FileClient( const std::string& shareFileUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileClientOptions& options = FileClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp index 28f46209f..50f12a0ab 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp @@ -3,9 +3,9 @@ #pragma once -#include "azure/core/credentials/credentials.hpp" #include "azure/core/http/pipeline.hpp" #include "azure/core/response.hpp" +#include "azure/identity/client_secret_credential.hpp" #include "azure/storage/common/storage_credential.hpp" #include "azure/storage/files/shares/protocol/share_rest_client.hpp" #include "azure/storage/files/shares/share_options.hpp" @@ -50,7 +50,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ explicit ServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const ServiceClientOptions& options = ServiceClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-shares/src/share_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_client.cpp index 32eb5cd55..ecca5737c 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/shares/share_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/crypt.hpp" @@ -65,7 +65,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareClient::ShareClient( const std::string& shareUri, - std::shared_ptr credential, + std::shared_ptr credential, const ShareClientOptions& options) : m_shareUri(shareUri) { @@ -83,9 +83,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp index 99d3a7339..007e81aac 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/shares/share_directory_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/crypt.hpp" @@ -66,7 +66,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { DirectoryClient::DirectoryClient( const std::string& shareDirectoryUri, - std::shared_ptr credential, + std::shared_ptr credential, const DirectoryClientOptions& options) : m_shareDirectoryUri(shareDirectoryUri) { @@ -84,9 +84,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index 3cfa4a328..b2e2981d0 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/shares/share_file_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/concurrent_transfer.hpp" #include "azure/storage/common/constants.hpp" @@ -69,7 +69,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { FileClient::FileClient( const std::string& shareFileUri, - std::shared_ptr credential, + std::shared_ptr credential, const FileClientOptions& options) : m_shareFileUri(shareFileUri) { @@ -87,9 +87,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp index 8e7d4e24f..cf88cdf23 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_service_client.cpp @@ -3,7 +3,7 @@ #include "azure/storage/files/shares/share_service_client.hpp" -#include "azure/core/credentials/policy/policies.hpp" +#include "azure/core/credentials.hpp" #include "azure/core/http/curl/curl.hpp" #include "azure/storage/common/constants.hpp" #include "azure/storage/common/shared_key_policy.hpp" @@ -61,7 +61,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ServiceClient::ServiceClient( const std::string& serviceUri, - std::shared_ptr credential, + std::shared_ptr credential, const ServiceClientOptions& options) : m_serviceUri(serviceUri) { @@ -79,9 +79,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { policies.emplace_back(p->Clone()); } policies.emplace_back(std::make_unique()); - policies.emplace_back( - std::make_unique( - credential, Azure::Storage::Details::c_StorageScope)); + policies.emplace_back(std::make_unique( + credential, Azure::Storage::Details::c_StorageScope)); policies.emplace_back(std::make_unique( std::make_shared())); m_pipeline = std::make_shared(policies); diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2a8a7e46a..c85de77ac 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,7 @@ trigger: - eng/ - CMakeLists.txt - sdk/core + - sdk/identity - sdk/storage pr: @@ -27,6 +28,7 @@ pr: - eng/ - CMakeLists.txt - sdk/core/ + - sdk/identity/ - sdk/storage stages: diff --git a/sdk/template/azure-template/inc/azure/template/version.hpp b/sdk/template/azure-template/inc/azure/template/version.hpp index e8182d5c9..3677ddc76 100644 --- a/sdk/template/azure-template/inc/azure/template/version.hpp +++ b/sdk/template/azure-template/inc/azure/template/version.hpp @@ -18,10 +18,10 @@ namespace Azure { namespace Template { static constexpr int Minor = AZURE_TEMPLATE_VERSION_MINOR; static constexpr int Patch = AZURE_TEMPLATE_VERSION_PATCH; static std::string const PreRelease; - static std::string const VersionString(); + static std::string VersionString(); private: - //To avoid leaking out the #define values we smuggle out the value + // To avoid leaking out the #define values we smuggle out the value // which will later be used to initialize the PreRelease std::string static constexpr const char* secret = AZURE_TEMPLATE_VERSION_PRERELEASE; }; diff --git a/sdk/template/azure-template/src/version.cpp b/sdk/template/azure-template/src/version.cpp index 16ebde750..fcb8b88a6 100644 --- a/sdk/template/azure-template/src/version.cpp +++ b/sdk/template/azure-template/src/version.cpp @@ -2,28 +2,27 @@ // SPDX-License-Identifier: MIT #include -#include #include +#include using namespace Azure::Template; const std::string Version::PreRelease = secret; -std::string const Azure::Template::Version::VersionString() +std::string Azure::Template::Version::VersionString() { static const std::string versionString = [] { - std::string version; - std::stringstream ss; - std::string dot = "."; + std::string version; + std::stringstream ss; + std::string dot = "."; - ss << Version::Major << dot << Version::Minor << dot << Version::Patch; + ss << Version::Major << dot << Version::Minor << dot << Version::Patch; - if (!Version::PreRelease.empty()) - ss << "-" << Version::PreRelease; + if (!Version::PreRelease.empty()) + ss << "-" << Version::PreRelease; - return ss.str(); + return ss.str(); }(); return versionString; } -