BearerTokenAuthenticationPolicy to use shared_lock in case no refresh is needed#5188
Merged
antkmsft merged 6 commits intoAzure:mainfrom Nov 28, 2023
Merged
BearerTokenAuthenticationPolicy to use shared_lock in case no refresh is needed#5188antkmsft merged 6 commits intoAzure:mainfrom
BearerTokenAuthenticationPolicy to use shared_lock in case no refresh is needed#5188antkmsft merged 6 commits intoAzure:mainfrom
Conversation
LarryOsterman
approved these changes
Nov 28, 2023
Member
LarryOsterman
left a comment
There was a problem hiding this comment.
My only concern is the 1970 year bias when creating the Azure::DateTime object, otherwise it looks fine.
ahsonkhan
reviewed
Nov 29, 2023
Comment on lines
+65
to
+74
| bool TokenNeedsRefresh( | ||
| Azure::Core::Credentials::AccessToken const& cachedToken, | ||
| Azure::Core::Credentials::TokenRequestContext const& cachedTokenRequestContext, | ||
| Azure::DateTime const& currentTime, | ||
| Azure::Core::Credentials::TokenRequestContext const& newTokenRequestContext) | ||
| { | ||
| return newTokenRequestContext.TenantId != cachedTokenRequestContext.TenantId | ||
| || newTokenRequestContext.Scopes != cachedTokenRequestContext.Scopes | ||
| || currentTime > (cachedToken.ExpiresOn - newTokenRequestContext.MinimumExpiration); | ||
| } |
Contributor
There was a problem hiding this comment.
This logic could benefit from a comment. For example, I understand that we need a token refresh if the tenant id and scope don't match, but why are we using current token's and cached token's expirations together like this: cachedToken.ExpiresOn - newTokenRequestContext.MinimumExpiration?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4756.
--
UWP CI is currently blocked until microsoft/vcpkg#35279 is fixed / microsoft/vcpkg#35116 is merged (#5181 would unblock)