Skip to content

Conversation

@pvaneck
Copy link
Member

@pvaneck pvaneck commented Jul 22, 2024

Here, we add a few new classes to core to support adding/using more data in access tokens received from credentials.

  • AccessTokenInfo: A new alternative class to AccessToken which isn't tuple-based and supports refresh_on as well as future extensibility. This naming indicates it's more of a container class for a token and token metadata.
  • SupportsTokenInfo: A new Protocol class. This specifies the method get_token_info.
  • TokenRequestOptions will be a TypeDict that will maintain the optional options for token requests, and will be used in the get_token_info method signature. This helps us move away from having to keep adding new kwargs to get_token's method signature every time we need to add new parameters.
  • AsyncSupportsTokenInfo: The async counterpart to SupportsTokenInfo.

Our BearerTokenCredential policies will check if a credential has the get_token_info method. If so, call it. Otherwise, just call get_token.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jul 22, 2024

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-core

@pvaneck pvaneck force-pushed the core-new-protocol-method branch 2 times, most recently from 25b5a53 to ef7f41b Compare July 24, 2024 03:27
@pvaneck pvaneck marked this pull request as ready for review July 24, 2024 22:08
@pvaneck pvaneck force-pushed the core-new-protocol-method branch 2 times, most recently from 60904c4 to dfa0f3a Compare July 26, 2024 22:13
@pvaneck pvaneck changed the title [Core] Add new ExpandedTokenProtocols [Core] Add new token class and protocols Aug 8, 2024
@pvaneck pvaneck force-pushed the core-new-protocol-method branch from 3e39891 to ab35a3b Compare August 8, 2024 01:33
Adding new protocols to enable more expansive access
tokens.

Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
@pvaneck pvaneck force-pushed the core-new-protocol-method branch from 21d7dc3 to 74854d2 Compare August 21, 2024 02:01
@pvaneck pvaneck requested a review from mccoyp as a code owner August 21, 2024 02:01
Signed-off-by: Paul Van Eck <[email protected]>
@pvaneck
Copy link
Member Author

pvaneck commented Sep 5, 2024

CI failures are unrelated to the changes in this PR and have to do with engsys issues that cropped up recently. The failing pipelines just passed yesterday.

Copy link
Member

@mccoyp mccoyp left a comment

Choose a reason for hiding this comment

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

KV updates LGTM!

@pvaneck
Copy link
Member Author

pvaneck commented Sep 5, 2024

/check-enforcer override

@pvaneck pvaneck merged commit 526dca6 into Azure:main Sep 5, 2024
@pvaneck pvaneck deleted the core-new-protocol-method branch September 5, 2024 22:31
l0lawrence pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
Add new AccessTokenInfo class and supporting protocols
AsyncSupportsTokenInfo and SupportsTokenInfo.

Signed-off-by: Paul Van Eck <[email protected]>
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.

6 participants