Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Fix issue that ADAL mistakenly set token expiration time in local storage #898

Closed

Conversation

Gang-Peng
Copy link

What:
ADAL has this issue that it will update 'adal.expiration.key' based on current local time + expires_in info from AAD, however, if the callback is not executed on time due to all kinds of reasons, such as browser tabs are inactive or computer is sleeping, then it may get into this state that token expiration time is mistakenly set.

How:
To fix the issue, when ADAL requests AAD access token, it will pass its current local time in the "state" query parameter, which will be returned by AAD on success, and we will use the passed in local time in "state" to calculate the correct token expiration time and set it to "adal.expiration.key" inside local storage.

tushargupta51 and others added 30 commits November 8, 2016 15:49
Moving usage and details to wiki
fixed issue with responseType id_token token
fixed callback issue with acquireTokenRedirect api
fixed circular reference error in JSON.stringify
Cache the values of _supportsLocalStorage and _supportsSessionStorage
nehaagrawal and others added 24 commits November 15, 2018 10:40
Adal release 1.0.18
updated dist file for adal release 1.0.18
updated atob version
Reverse the AzureAD#839 Circular Reference Error Fix - currently customer reported a scope error
Fixes AzureAD#862 . This updates the library's CDN links so that they use the latest available release (at the time of committing). These links were changed in 0239b40, which appears to have been copied/cherry-picked from the dev branch where 1.0.18 is being worked on (PR AzureAD#839 ). Since this release is not out yet, and these links 404, they have been updated to use the latest release of the library (1.0.17).
While I'm at it, rollback the current version number to be 1.0.17 in the readme.
No new features, only security fixes for ADAL for JavaScript
…rage

What:
ADAL has this issue that it will update 'adal.expiration.key' based on current local time + expires_in info from AAD, however, if the callback is not executed on time due to all kinds of reasons, such as browser tabs are inactive or computer is sleeping, then it may get into this state that token expiration time is mistakenly set.

How:
To fix the issue, when ADAL requests AAD access token, it will pass its current local time in the "state" query parameter, which will be returned by AAD on success, and we will use the passed in local time in "state" to calculate the correct token expiration time and set it to "adal.expiration.key" inside local storage.
@msftclas
Copy link

msftclas commented Feb 27, 2020

CLA assistant check
All CLA requirements met.

lib/adal.js Outdated Show resolved Hide resolved
@jasonnutter
Copy link
Contributor

Thanks @Gang-Peng, this is a great fix!

…to be current local time, which simplifies logic inside _expiresIn function
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.