-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix the CAE bug in js core lib #22324
Changes from 9 commits
6cf9c13
c82a5dd
6d67189
85b4f60
dff1663
4bc68c2
a05c61f
c2087ab
0fdfc78
93ecd56
832c5d9
93fd378
fcbe942
35f36e7
15b4d31
1f89098
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,9 +201,11 @@ export function createTokenCycler( | |
// step 1. | ||
// | ||
|
||
// IF the tenantId passed in token options is different to the one we have, we need to | ||
// refresh the token with the new tenantId. | ||
const mustRefresh = tenantId !== tokenOptions.tenantId || cycler.mustRefresh; | ||
// If the tenantId passed in token options is different to the one we have | ||
// Or if we are in claim challenge and the token was rejected and a new access token need to be issued, we need to | ||
// refresh the token with the new tenantId or token. | ||
const mustRefresh = | ||
tenantId !== tokenOptions.tenantId || Boolean(tokenOptions.claims) || cycler.mustRefresh; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so whenever we see claims, we know we have to refresh? Can we add a test with claims and one without to make sure those booleans are covered? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a test to cover that |
||
|
||
if (mustRefresh) return refresh(scopes, tokenOptions); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the claims we get from the challenge right? We are already passing it in
authorizeRequestOnClaimChallenge
callback but forgot to update this interface when the callback was originally addedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly! This parameter is already passed in code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks for adding it! Could you please add an entry to core-auth CHANGELOG?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to also remove the "as GetTokenOptions" cast https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client/src/authorizeRequestOnClaimChallenge.ts#L87 as it is no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated