AzureAD / azure-activedirectory-library-for-python

ADAL for Python
http://adal-python.readthedocs.io
Other
259 stars 94 forks source link

Cache driver should update refresh token entries based on user id and authority #216

Closed Isaac-Lee-msft closed 4 years ago

Isaac-Lee-msft commented 4 years ago

Bug occurred when trying to login to a container in a private cloud environment and azure-cli used a cached refresh token for a different cloud environment. Upon further inspection, it appeared that the refresh tokens were all being updated to the same token in the cache for different cloud environments. The fix is to also verify the authority with the id when updating the cached refresh token entries.

Bug reproduction steps: az cloud set --name privatecloud az login az cloud set --name publiccloud az login -- wait for access token to expire -- az acr login --debug --name <containerOnPrivate>

AADSTS9002313: Invalid request. Request is malformed or invalid.

Please edit this line and possibly others to include the authority: https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/a4366c5e81a20d60d8e018a6fe24d0971f0cd02d/adal/cache_driver.py#L217

rayluo commented 4 years ago

Thanks for bringing this to our attention.

rayluo commented 4 years ago

CCing @jiasli for awareness on this topic. And we (ADAL Python team) would probably close this issue soon, since it is not actionable from our side here.

rayluo commented 4 years ago

Closing as this is not actionable from ADAL Python