Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[identity] Expires on timestamp should be in seconds not ms #23920

Merged
merged 5 commits into from
Nov 18, 2022

Conversation

KarishmaGhiya
Copy link
Member

@KarishmaGhiya KarishmaGhiya commented Nov 18, 2022

Packages impacted by this PR

@azure/identity

Issues associated with this PR

Fixes #23903

Describe the problem that is addressed by this PR

The "expiresOnTimestamp" field in Managed Identity should be in seconds and was assigned milliseconds. The PR fixes the bug

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

Are there test cases added in this PR? (If not, why?)

Provide a list of related PRs (if any)

Command used to generate this PR:**(Applicable only to SDK release request PRs)

Checklists

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

@ghost ghost added the Azure.Identity label Nov 18, 2022
@KarishmaGhiya KarishmaGhiya changed the title update tests [identity] Expires on timestamp should be in seconds not ms Nov 18, 2022
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

Post release automated changes for azure-identity
@KarishmaGhiya KarishmaGhiya merged commit 4ced48e into main Nov 18, 2022
@KarishmaGhiya KarishmaGhiya deleted the hotfix/identity_3.1.1 branch November 18, 2022 23:33
@@ -255,7 +255,7 @@ export class ManagedIdentityCredential implements TokenCredential {
logger.info(`token = ${resultToken.token}`);
return {
accessToken: resultToken?.token,
expiresInSeconds: resultToken?.expiresOnTimestamp,
expiresInSeconds: resultToken?.expiresOnTimestamp / 1000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is undefined won't this return NaN? Also what if it's not divisible by 1000?

Perhaps something more robust like

expiresInSeconds: resultToken?.expiresOnTimestamp ? Math.ceil(resultToken?.expiresOnTimestamp / 1000) : undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access token is not refreshed when workload indentity is used in AKS
5 participants