diff --git a/sdk/identity/azure-identity/inc/azure/identity/azure_cli_credential.hpp b/sdk/identity/azure-identity/inc/azure/identity/azure_cli_credential.hpp index 981296692b..9bf79ccb90 100644 --- a/sdk/identity/azure-identity/inc/azure/identity/azure_cli_credential.hpp +++ b/sdk/identity/azure-identity/inc/azure/identity/azure_cli_credential.hpp @@ -110,8 +110,9 @@ namespace Azure { namespace Identity { private: #else protected: + virtual #endif - virtual std::string GetAzCommand(std::string const& scopes, std::string const& tenantId) const; + std::string GetAzCommand(std::string const& scopes, std::string const& tenantId) const; virtual int GetLocalTimeToUtcDiffSeconds() const; }; diff --git a/sdk/identity/azure-identity/inc/azure/identity/detail/token_cache.hpp b/sdk/identity/azure-identity/inc/azure/identity/detail/token_cache.hpp index 6ca49b82bc..14d17980fb 100644 --- a/sdk/identity/azure-identity/inc/azure/identity/detail/token_cache.hpp +++ b/sdk/identity/azure-identity/inc/azure/identity/detail/token_cache.hpp @@ -9,6 +9,8 @@ #pragma once +#include "azure/identity/dll_import_export.hpp" + #include #include @@ -24,21 +26,15 @@ namespace Azure { namespace Identity { namespace _detail { * @brief Access token cache. * */ - class TokenCache -#if !defined(TESTING_BUILD) - final -#endif - { -#if !defined(TESTING_BUILD) + class TokenCache _azure_NON_FINAL_FOR_TESTS { private: -#else - protected: -#endif - // A test hook that gets invoked before cache write lock gets acquired. - virtual void OnBeforeCacheWriteLock() const {}; + _azure_VIRTUAL_FOR_TESTS + // A test hook that gets invoked before cache write lock gets acquired. + void + OnBeforeCacheWriteLock() const {}; // A test hook that gets invoked before item write lock gets acquired. - virtual void OnBeforeItemWriteLock() const {}; + _azure_VIRTUAL_FOR_TESTS void OnBeforeItemWriteLock() const {}; struct CacheKey { @@ -63,7 +59,6 @@ namespace Azure { namespace Identity { namespace _detail { mutable std::map, CacheKeyComparator> m_cache; mutable std::shared_timed_mutex m_cacheMutex; - private: TokenCache(TokenCache const&) = delete; TokenCache& operator=(TokenCache const&) = delete; diff --git a/sdk/identity/azure-identity/inc/azure/identity/dll_import_export.hpp b/sdk/identity/azure-identity/inc/azure/identity/dll_import_export.hpp index 6b01515fb1..ce74ac15a8 100644 --- a/sdk/identity/azure-identity/inc/azure/identity/dll_import_export.hpp +++ b/sdk/identity/azure-identity/inc/azure/identity/dll_import_export.hpp @@ -38,6 +38,14 @@ #undef AZ_IDENTITY_BUILT_AS_DLL +#if defined(_azure_TESTING_BUILD) +#define _azure_NON_FINAL_FOR_TESTS +#define _azure_VIRTUAL_FOR_TESTS virtual +#else +#define _azure_NON_FINAL_FOR_TESTS final +#define _azure_VIRTUAL_FOR_TESTS +#endif + /** * @brief Azure SDK abstractions. *