Skip to content
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

Add Token Caching Support For Managed Identity #30282

Merged
merged 13 commits into from
Aug 12, 2022

Conversation

g2vinay
Copy link
Member

@g2vinay g2vinay commented Aug 4, 2022

Integrates the Managed Identity Auth flow to use In Memory Token Caching

Vinay Gera added 2 commits August 1, 2022 12:11
@ghost ghost added the Azure.Identity label Aug 4, 2022
@g2vinay g2vinay requested a review from billwert August 4, 2022 20:57
@azure-sdk
Copy link
Collaborator

API change check

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

azure-identity

@g2vinay g2vinay requested review from srnagar and mssfang August 4, 2022 21:04
@g2vinay g2vinay requested a review from schaabs August 4, 2022 21:35
Copy link
Contributor

@billwert billwert left a comment

Choose a reason for hiding this comment

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

  1. Can we add better tests for the new codepath? I think the modification to the existing tests is just to ensure we hit the getTokenFromTargetManagedIdentity change.
  2. In the places where a public credential type has been changed to call authenticateWithManagedIdentityConfidentialClient should we private the correponding IdentityClient method? (For example authenticateToArcManagedIdentityEndpoint

return clientOptions.setManagedIdentityType(ManagedIdentityType.VM);
case AKS:
return clientOptions.setManagedIdentityType(ManagedIdentityType.AKS);
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

is NONE really a valid value? should this be an error?

Copy link
Member Author

@g2vinay g2vinay Aug 11, 2022

Choose a reason for hiding this comment

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

Removed NONE on second design iteration.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I'm not sure that's entirely right either - now won't the default value be VM? We probably need a NONE or DEFAULT to indicate the unchosen value?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah in our code flow we default to VM, that's our default based on the logic we follow.
None or Unchosen are invalid states to have and are equivalent to the value being null.

@g2vinay
Copy link
Member Author

g2vinay commented Aug 11, 2022

  1. Can we add better tests for the new codepath? I think the modification to the existing tests is just to ensure we hit the getTokenFromTargetManagedIdentity change.
  2. In the places where a public credential type has been changed to call authenticateWithManagedIdentityConfidentialClient should we private the correponding IdentityClient method? (For example authenticateToArcManagedIdentityEndpoint

For 1. We can add some Identity Client level helper method tests, which I will push in next commit, Msal callback flow is tested on msal end

For 2. It is an impl class, nothing that impacts users from API point of view, we can make it private, but won't create any user impact.

@billwert
Copy link
Contributor

For 2. It is an impl class, nothing that impacts users from API point of view, we can make it private, but won't create any user impact.

Yeah, I was thinking to be clear about our intent that these methods are not to be used from other creds in the future.

@g2vinay g2vinay requested a review from billwert August 12, 2022 00:19
Vinay Gera added 2 commits August 11, 2022 18:11
Copy link
Contributor

@billwert billwert left a comment

Choose a reason for hiding this comment

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

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants