-
Notifications
You must be signed in to change notification settings - Fork 99
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
Adding the ability to switch between basic authentication and token-based authentication #2944
Conversation
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2944 +/- ##
==========================================
- Coverage 93.54% 93.47% -0.07%
==========================================
Files 104 104
Lines 10889 10978 +89
Branches 2293 2400 +107
==========================================
+ Hits 10186 10262 +76
- Misses 702 715 +13
Partials 1 1 ☔ View full report in Codecov by Sentry. |
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 @SanthoshiBoyina1!
Tested this PR with a config file that had user/password in base profile. Switching first time stored token in base profile, and then switching back stored user/password directly on service profile. Although this is different from the original state of my config file, I think it is expected behavior 👍
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "user")?.argLoc.jsonLoc}`); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "password")?.argLoc.jsonLoc}`); |
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.
The string interpolation isn't necessary here:
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "user")?.argLoc.jsonLoc}`); | |
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "password")?.argLoc.jsonLoc}`); | |
configApi.delete(profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "user")?.argLoc.jsonLoc); | |
configApi.delete(profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "password")?.argLoc.jsonLoc); |
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenType")?.argLoc.jsonLoc}`); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenValue")?.argLoc.jsonLoc}`); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenExpiration")?.argLoc.jsonLoc}`); | ||
} else { | ||
const profAttrs = await this.getProfileFromConfig(profileName); | ||
configApi.set(`${profAttrs.profLoc.jsonLoc}.secure`, ["user", "password"]); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenType")?.argLoc.jsonLoc}`); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenValue")?.argLoc.jsonLoc}`); | ||
configApi.delete(`${profInfo.mergeArgsForProfile(profAttrs).knownArgs.find((arg) => arg.argName === "tokenExpiration")?.argLoc.jsonLoc}`); |
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.
Same comment as above about string interpolation 😋
@@ -1361,7 +1511,7 @@ export class Profiles extends ProfilesCache { | |||
.map((arg) => arg.argName); | |||
} | |||
|
|||
private async loginWithRegularProfile(serviceProfile: zowe.imperative.IProfileLoaded, node?: IZoweNodeType): Promise<boolean> { | |||
public async loginWithRegularProfile(serviceProfile: zowe.imperative.IProfileLoaded, node?: IZoweNodeType): Promise<boolean> { |
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.
This method seems like it could be kept private if the only added call is inside this file.
seeing some odd behavior, but I believe the changes I requested earlier were addressed
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.
Could we wait for one more day before merging?
Just seeing a few things that may or may not be related.
Signed-off-by: Santhoshi Boyina <[email protected]>
Signed-off-by: Santhoshi Boyina <[email protected]>
…/vscode-extension-for-zowe into feat/authSwitch Signed-off-by: Santhoshi Boyina <[email protected]>
c781f13
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 @SanthoshiBoyina1!
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.
apologies for the delay.
I'll open the issue I mentioned in a few moments
@SanthoshiBoyina1 @JillieBeanSim Should this feature be ported to the vNext branch? |
I will move this feature to vNext branch |
Done in #3062 |
Proposed changes
To add the ability to switch between basic authentication and token-based authentication.
Release Notes
Milestone:
Changelog:
Types of changes
What types of changes does your code introduce to Zowe Explorer?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the revieweryarn workspace vscode-extension-for-zowe vscode:prepublish
has been executedFurther comments