-
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
[Cosmos] AAD authentication sync client #23604
Conversation
API changes have been detected in |
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py
Outdated
Show resolved
Hide resolved
API changes have been detected in |
This reverts commit 721bbc7.
API changes have been detected in |
API changes have been detected in |
API changes have been detected in |
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py
Outdated
Show resolved
Hide resolved
API changes have been detected in |
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
API changes have been detected in |
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.
LGTM, thanks
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
API change check for API changes have been detected in |
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
* working authentication to get database account * working aad authentication for sync client with sample * readme and changelog * pylint and better comments on sample * Update auth.py * Revert "Update auth.py" This reverts commit 721bbc7. * Update auth.py * Update auth.py * changes from comments * quick comment updates * Update config.py * Update access_cosmos_with_aad.py * added sync policy to match async * small changes * aad tests for negative path and positive emulator path * moved logic to be together for each part * Milis comments * Update cosmos_client.py * Update dev_requirements.txt * Update _auth_policy.py
* working authentication to get database account * working aad authentication for sync client with sample * readme and changelog * pylint and better comments on sample * Update auth.py * Revert "Update auth.py" This reverts commit 721bbc7. * Update auth.py * Update auth.py * changes from comments * quick comment updates * Update config.py * Update access_cosmos_with_aad.py * added sync policy to match async * small changes * aad tests for negative path and positive emulator path * moved logic to be together for each part * Milis comments * Update cosmos_client.py * Update dev_requirements.txt * Update _auth_policy.py
This PR has the changes for the sync client to utilize AAD authentication. I'll be making the PR for the async client separate, in order to reduce number of lines per PR.
The way the
@azure.identity
package uses AAD credentials to authenticate services is by adding those credentials into a policy that runs when requests are sent to the core pipelines. This policy makes sure to refresh the current token if needed and set the authentication header of requests going to the pipeline. The reason why Cosmos had to create their own policy in this instance is due to the prefix we utilize for our tokens, since the bearer token policy given by the identity module sends a different prefix altogether and as such does not work for us.It was also recommended by the identity team to create our own policies entirely rather than attempting to override a couple methods, since this could break us on their end - specially for the
_update_headers()
method since it's private.Sample is a simple run-through of what can and can't be done, if you think adding more examples would be helpful I can do so as well.