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

Cache tokens by specified environment, not by OIDC Discovery #247

Merged
merged 1 commit into from
Sep 16, 2020

Conversation

rayluo
Copy link
Collaborator

@rayluo rayluo commented Aug 28, 2020

@abhidnya13 please help verify this, both by re-running our BF/FF manual tests, and by code review, to see whether this can address the issue we found recently.

@rayluo rayluo requested a review from abhidnya13 August 28, 2020 02:43
@abhidnya13
Copy link
Contributor

I reviewed this PR by testing BF/FF test cases, and the error of not finding tokens in cache is now gone, so it looks good from migration perspective.
Other than that, it however change the normal cache look up behavior? Are there any concerns regarding that? If two apps are storing token App1 has an input authority of env1 in cache and App2 has env2 (app using some other MSALs storing this based off the actual authority value from service and not the user). MSAL python in App1 wont be able to get the env2 token stored by app2 even if it is a valid token to be used.

@rayluo
Copy link
Collaborator Author

rayluo commented Aug 28, 2020

Excellent question. We need to come up more and more of these kind of different scenarios to help us evaluate this PR.

In this particular case that you brought up, please help me stress-test my following assumption. The findings of this migration test makes us realize that, MSAL Python (or at least, its get_accounts() and acquire_token_silent() parts) never worked for a corner case when the app-specified authority env1 does not match with the OIDC-discovered endpoint env_one. In other words, it would only fully work when env1 and env_one are identical (true or false?). In that case, there shouldn't be any tangible difference when we switch the token cache from env_one to env1 this time.

W.R.T. app1 with authority env1 and app2 with env2 (and assuming their OIDC-discovered endpoints are also env1 and env2, respectively), were they previously able to share token cache with each other in the first place?

@rayluo rayluo marked this pull request as ready for review September 10, 2020 03:09
Copy link
Contributor

@abhidnya13 abhidnya13 left a comment

Choose a reason for hiding this comment

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

LGTM

@rayluo
Copy link
Collaborator Author

rayluo commented Sep 16, 2020

Thanks. We are merging this PR. Once merged, you would then need to use 1.5.0 version to reproduce the pre-adjustment behavior, should we need to mimic that situation again during our recent migration tests.

@rayluo rayluo merged commit a558775 into dev Sep 16, 2020
@rayluo rayluo deleted the cache-tokens-by-specified-environment branch September 16, 2020 04:02
@rayluo rayluo mentioned this pull request Oct 21, 2020
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