az cli returns expiresOn in local time but sdk assumes c++ time #5075
Labels
Azure.Identity
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
Describe the bug
When using an AzureCliCredential, the
ExpiresOn
field is parsed from the the output of the callwhich returns the field
expiresOn
in local time but does not add time zone information. However,Azure::DateTime
assumes - when no time zone information is present - that the date is in UTC.The
IsFresh
method of Azure::TokenCache then compares the parsedExpiresOn
withAzure::DateTime(std::chrono::system_clock::now())
which is UTC time thus yielding a wrong comparison.Exception or Stack Trace
To Reproduce
Steps to reproduce the behavior:
Inject the following debug code in
TokenCache::IsFresh
intoken_cache.cpp
:Then call any api using the
AzureCliCredential
that requires a token.Code Snippet
Expected behavior
The AzureCliCredential should correctly take the time zone information into account.
Screenshots
Setup (please complete the following information):
1.6.0-beta.1
and Azure Core1.10.2
Additional context
Add any other context about the problem here.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: