-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Auth} Support get_token_info protocol
#30928
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
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
| return None | ||
|
|
||
|
|
||
| def _generate_msal_kwargs(options=None): |
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.
Unifying the msal_kwargs generation logic also fixes the claims argument for get_token (#30062 (comment)).
| # For VM SSH. 'data' support is a CLI-specific extension. | ||
| # SDK doesn't support 'data': https://github.com/Azure/azure-sdk-for-python/pull/16397 | ||
| if 'data' in options: | ||
| msal_kwargs['data'] = options['data'] |
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.
data is currently only officially used by ssh extension:
credential, _, _ = profile.get_login_credentials(subscription_id=profile.get_subscription()["id"])
certificatedata = credential.get_token(*scopes, data=data)| self._credential = credential | ||
| self._auxiliary_credentials = auxiliary_credentials | ||
|
|
||
| def get_token(self, *scopes, **kwargs): |
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.
get_token is kept as ssh extension still direclty uses it to get an SSH certificate:
credential, _, _ = profile.get_login_credentials(subscription_id=profile.get_subscription()["id"])
certificatedata = credential.get_token(*scopes, data=data)
certificate = certificatedata.token| return msal_kwargs | ||
|
|
||
|
|
||
| def _build_sdk_access_token_info(token_entry): |
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.
build_sdk_access_token is still used by azure.cli.core.auth.adal_authentication.MSIAuthenticationWrapper.get_token:
| return build_sdk_access_token(result) |
so it can't be moved to src/azure-cli-core/azure/cli/core/auth/credential_adaptor.py right now.
Related command
az loginDescription
Require #29955
Close #29967
Support the new
get_token_infoprotocol introduced byazure-core1.31.0 (Azure/azure-sdk-for-python#36565).azure-corewas bumped to 1.31.0 in #29944.