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

Handle string time values when caching responses #55

Merged
merged 3 commits into from
Jun 11, 2019

Conversation

chlowell
Copy link
Contributor

@chlowell chlowell commented Jun 6, 2019

If response["expires_in"] is a string--as is the case for Azure Instance Metadata Service auth responses--lines 142 and 144 will raise because strings and integers can't be added. This change ensures all addends (now, expires_in, ext_expires_in) are integers.

This also fixes an issue with the access token key maker. It accepts an optional client_id but when this is unspecified, the key maker passes None to str.join, which raises. I changed this to pass the empty string instead, as do other key makers.

Copy link
Collaborator

@rayluo rayluo left a comment

Choose a reason for hiding this comment

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

Talked to IMDS team and confirmed that they do have a long term plan to move to AAD v2 endpoint (which removes that "expires_in" as string behavior).

Meanwhile, we will take this PR as a workaround.

Also thanks @chlowell for fixing that "client_id could be None" issue in the key maker. That is a legit fix, and key maker is happy. :-)

Key Maker

@rayluo rayluo merged commit 4c52458 into AzureAD:dev Jun 11, 2019
@chlowell chlowell deleted the imds-fixes branch June 11, 2019 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants