diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 45890c91f..5234dc8e6 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -16,6 +16,7 @@ - Moved `Azure::Core::BearerTokenAuthenticationPolicy`, defined in `azure/core/credentials.hpp` to `Azure::Core::Http` namespace in `azure/core/http/policy.hpp` header. - Removed option `AllowBeast` from `CurlTransportSSLOptions` in `CurlTransportOptions`. - Changed default option `NoRevoke` from `CurlTransportSSLOptions` for the `CurlTransportOptions` to `true`. This disables the revocation list checking by default. +- Changed type of `Token::ExpiresOn` to `DateTime`. ### Bug Fixes diff --git a/sdk/core/azure-core/inc/azure/core/credentials.hpp b/sdk/core/azure-core/inc/azure/core/credentials.hpp index 928b70281..cac34bc21 100644 --- a/sdk/core/azure-core/inc/azure/core/credentials.hpp +++ b/sdk/core/azure-core/inc/azure/core/credentials.hpp @@ -9,8 +9,8 @@ #pragma once #include "azure/core/context.hpp" +#include "azure/core/datetime.hpp" -#include #include #include #include @@ -33,7 +33,7 @@ namespace Azure { namespace Core { /** * @brief Token expiration. */ - std::chrono::system_clock::time_point ExpiresOn; + DateTime ExpiresOn; }; /** diff --git a/sdk/core/azure-core/src/http/bearer_token_authentication_policy.cpp b/sdk/core/azure-core/src/http/bearer_token_authentication_policy.cpp index c0badc933..9e5bca0cc 100644 --- a/sdk/core/azure-core/src/http/bearer_token_authentication_policy.cpp +++ b/sdk/core/azure-core/src/http/bearer_token_authentication_policy.cpp @@ -14,7 +14,7 @@ std::unique_ptr BearerTokenAuthenticationPolicy::Send( { std::lock_guard lock(m_accessTokenMutex); - if (std::chrono::system_clock::now() > m_accessToken.ExpiresOn) + if (DateTime::Now() > m_accessToken.ExpiresOn) { m_accessToken = m_credential->GetToken(context, m_scopes); } diff --git a/sdk/identity/azure-identity/src/client_secret_credential.cpp b/sdk/identity/azure-identity/src/client_secret_credential.cpp index f5ef6b7e4..9e4bcba55 100644 --- a/sdk/identity/azure-identity/src/client_secret_credential.cpp +++ b/sdk/identity/azure-identity/src/client_secret_credential.cpp @@ -180,7 +180,7 @@ Azure::Core::AccessToken ClientSecretCredential::GetToken( return { std::string(responseBodyBegin + tokenBegin, responseBodyBegin + tokenEnd), - std::chrono::system_clock::now() + DateTime::Now() + std::chrono::seconds(expiresInSeconds < 0 ? 0 : expiresInSeconds), }; }