-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Identity] Correctly implement TokenCredential protocols #31047
Conversation
sdk/identity/azure-identity/azure/identity/_credentials/managed_identity.py
Show resolved
Hide resolved
API change check APIView has identified API level changes in this PR and created following API reviews. |
sdk/identity/azure-identity/azure/identity/_credentials/chained.py
Outdated
Show resolved
Hide resolved
5999970
to
437b2d1
Compare
345bfca
to
475f782
Compare
f95549c
to
65d7552
Compare
Is it possible that claims/tenant_id are passed into transport? (want to check if we need to add such protection in core) |
This hasn't happened in live tests, but that doesn't give us full coverage of all credentials. I'm writing tests now to make sure the transport layer doesn't receive these. EDIT: added in fc5410b |
sdk/identity/azure-identity/azure/identity/_credentials/azd_cli.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/_credentials/chained.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/_credentials/default.py
Outdated
Show resolved
Hide resolved
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.
Thanks for doing this, @mccoyp! Just some minor doc fixes I think should go in.
With the recent support for CAE, all get_token
methods for user credentials and service principal credentials should support claims (this is mainly any credential that uses AadClient or inherits MsalCredential, example of claims usage). So, I think it makes sense to update the docstrings for these credentials.
sdk/identity/azure-identity/azure/identity/_credentials/authorization_code.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/_credentials/environment.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/_internal/get_token_mixin.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/aio/_credentials/authorization_code.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/aio/_credentials/environment.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/aio/_credentials/shared_cache.py
Outdated
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/aio/_internal/get_token_mixin.py
Outdated
Show resolved
Hide resolved
@xiangyan99 @pvaneck Do you think this can make it into next week's release? |
sdk/identity/azure-identity/azure/identity/aio/_credentials/azure_powershell.py
Show resolved
Hide resolved
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.
I think it would be nice to have nice this in if possible provided we can get the additional API changes approved. One thing I noticed when looking at the apiview was the removal of the Any
type from all the kwargs
in get_token
. What was the motivation for this? I see that the protocol method has the Any
still.
I had removed them because of an impression that |
Description
Resolves #25175.
azure-identity
credentials should all implement the TokenCredential protocol, but they technically don't at the moment. For both sync and async credentials, ourget_token
methods don't include all the parameters specified in the protocol. This PR update method signatures to match, and clarifies which parameters may be ignored in docstrings.Validating live Key Vault pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2958066&view=results
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines