Skip to content

Reimplement AadClient without msal.oauth2cli#11466

Merged
chlowell merged 10 commits intoAzure:masterfrom
chlowell:aadclient
May 29, 2020
Merged

Reimplement AadClient without msal.oauth2cli#11466
chlowell merged 10 commits intoAzure:masterfrom
chlowell:aadclient

Conversation

@chlowell
Copy link
Member

Upcoming features need an Azure AD client which separates acquiring tokens from caching them. We have two Azure AD clients, AuthnClient and AadClient, both of which require reshaping to meet this new requirement. I chose the latter because it has a simpler API. Its implementation, however, is quite complex and uses msal.oauth2cli, which the MSAL team doesn't consider public. So this PR takes the first step toward supporting new features by simplifying the implementation and removing usage of msal.oauth2cli.

While making these changes, I observed the async AuthorizationCodeCredential.get_token accepts two optional keyword arguments but doesn't use them correctly, provoking exceptions when either is passed. This has been the case since I added the credential in 1.0.0b4. Whoops 😇. This PR removes them because they have never worked and the AadClient changes make them obsolete.

@chlowell chlowell added Client This issue points to a problem in the data-plane of the library. Azure.Identity labels May 15, 2020
@chlowell chlowell requested a review from xiangyan99 May 15, 2020 18:50
@chlowell chlowell requested a review from schaabs as a code owner May 15, 2020 18:50

## 1.4.0b4 (Unreleased)
- `azure.identity.aio.AuthorizationCodeCredential.get_token()` no longer accepts
optional keyword arguments `executor` or `loop`. Prior versions of the method
Copy link
Member

Choose a reason for hiding this comment

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

executor & loop were already in 1.3.1?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, they've been around since 1.0.0b4.

Copy link
Member

Choose a reason for hiding this comment

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

So do we really want 1.4.0 to break 1.3.1?

Copy link
Member Author

Choose a reason for hiding this comment

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

As I wrote at the top of this PR, these arguments never worked. Trying to use them just raises exceptions.

Copy link
Member

Choose a reason for hiding this comment

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

So the behavior is
Raise exception -> silently ignored?

We should add it into Breaking Change section

@chlowell chlowell requested a review from xiangyan99 May 29, 2020 21:51
@chlowell chlowell merged commit ee78e5d into Azure:master May 29, 2020
@chlowell chlowell deleted the aadclient branch May 29, 2020 23:40
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Jun 1, 2020
…into fix_annotation_initial_response

* 'master' of https://github.com/Azure/azure-sdk-for-python:
  Adding digital twins CI configuration. (Azure#11730)
  Sync eng/common directory with azure-sdk-tools repository (Azure#11692)
  Reimplement AadClient without msal.oauth2cli (Azure#11466)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Identity Client This issue points to a problem in the data-plane of the library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants