-
Notifications
You must be signed in to change notification settings - Fork 437
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
feat: Add Token Credential Support #1624
Conversation
Add the ability to pass a credential object in to allow for all types of `@azure/identity` authentication scenarios and prep for the removal of the manual implementations of `@azure/identity` as the end user can configure any auth they want instead of being limited to the auth types that are hard coded.
Re-order the new credential chain auth type so that it is in a more logical order as it should not be higher priority than the default authentication option.
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.
Sweet, this looks great! Can you fix the formatting to use 2 spaces instead of tabs? 🙇
Latest version is not a breaking change on this project.
Fixed! I also bumped the |
missed this one :-P
Fix compile issues as the new auth type was not properly exposed and calling the correct metadata.
Accidentally put the new auth config type in instead of the @Azure/Identity chained token credential type. This caused build failures. This is fixed now.
Would you mind updating the lock file as well? |
The chained token credential works on a lot of the classes but it should be `TokenCredential` credential instead as not all azure identity class instances are chained credentials. All classes including the chained credential are token credentials though.
Missed these tabs
That would be important. One sec. |
The token retrieved may not be present. This was detected because of the stricter typing that I implemented.
I believe it is fixed now. |
More bugs, Wow, I am getting used to this project more than I thought I would. I should have just listened to the pull request instructions instead of trying to free hand it.
Migrated off of JS Doc to a method annotation instead.
I had some more time to look at this and think about this. 😅 How do you feel about renaming the credential method to
|
Also, in general I'd be in favor of deprecating (and removing) the other azure identity related authentication methods - it would allow us to completely drop the runtime dependency on |
I believe the actual constructor validation that I wrote is for token credential instead of change credential, as I was testing with some non-chained credentials it failed and I had to update the validation to support it properly. |
Renamed, let me know what you think! |
Change wording and types to use token credential components instead of chained credentials to be more flexible. Swapped to the core-auth SDK from MSFT to reduce dependence on the @azure/identity package since it will be removed in a future update.
I have ESLint working locally now for this project.
As requested by Arthur.
It looks like it ran successfully, it is just failing to connect to codecov? I could be wrong; I don't use that service yet. @arthurschreiber, any todo items for me? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1624 +/- ##
==========================================
- Coverage 78.45% 78.29% -0.17%
==========================================
Files 93 93
Lines 4860 4870 +10
Branches 933 936 +3
==========================================
Hits 3813 3813
- Misses 750 759 +9
- Partials 297 298 +1 ☔ View full report in Codecov by Sentry. |
I'm trying to figure out what's going on with codecov, seems like it needs to be updated to the latest version of the action (see #1627). |
Would you be okay with me taking the changes done so far in here and opening a new PR? I'd like to make sure we have tests running for this new functionality, but azure tests don't run on pull requests originating from forks because of security restrictions. |
On the condition that I get recognition, my ego demands it :-P maybe being added to the contributors section of the |
The commit(s) will stay attributed to you. 😬 |
my bad, works for me! |
Overview
Adds support for the base token credential authentication that is implemented by
@Azure/Identity
.This PR does not remove support for the other
@Azure/Identity
methods.The other auth methods are now able to be removed as the credential chain type supports whatever the end user throws at it. Default, service principal, and any combination of crazy auth methods and all future ones that MSFT adds to the MSAL system.
All
@Azure/Identity
auth classes derive from the credential chain class so all the other existing authentication methods are supported through this specific option as well as 100% of their configurations with no additional code that is required from us.See #1623 for more info.
This would be the core auth system work required to solve issues like #1144 as they would be able to use auth that makes sense for them.
Sample Documentation
microsoft-credential-chain
@Azure/Identity
. This could be any of the built-in credential types such asDefaultAzureCredential
,EnvironmentCredential
,ChainedTokenCredentia
,VisualStudioCodeCredential
, etc. All the MS supported classes derive from theTokenCredential
interface so all the pre-built auth methods are supported by inheritance. See the @Azure/Identity package's documentation (https://www.npmjs.com/package/@azure/identity) for more ways to customize your authentication experience for your environment's specifics.(optional section)
Best Practices
Migrate from other
azure-active-directory
prefixed auth config types to this one as they will be removed in the future to simplify the code base.