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

To Switch Basic auth. to Token auth. and viceversa #2867

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

SanthoshiBoyina
Copy link
Contributor

@SanthoshiBoyina SanthoshiBoyina commented Apr 22, 2024

Proposed changes

To switch from Basic authentication to Token based authentication and viceversa

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 apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Updates to Documentation or Tests (if none of the other choices apply)

Checklist

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 reviewer

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • PR title follows Conventional Commits Guidelines
  • PR Description is included
  • gif or screenshot is included if visual changes are made
  • yarn workspace vscode-extension-for-zowe vscode:prepublish has been executed
  • All checks have passed (DCO, Jenkins and Code Coverage)
  • I have added unit test and it is passing
  • I have added integration test and it is passing
  • There is coverage for the code that I have added
  • I have tested it manually and there are no regressions found
  • I have added necessary documentation (if appropriate)
  • Any PR dependencies have been merged and published (if appropriate)

Further comments

Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 90.19608% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 93.53%. Comparing base (a320a65) to head (0e62cd0).

Files Patch % Lines
packages/zowe-explorer/src/Profiles.ts 91.11% 4 Missing ⚠️
...kages/zowe-explorer/src/utils/ProfileManagement.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2867      +/-   ##
==========================================
+ Coverage   93.52%   93.53%   +0.01%     
==========================================
  Files         104      104              
  Lines       10891    10942      +51     
  Branches     2354     2372      +18     
==========================================
+ Hits        10186    10235      +49     
- Misses        704      706       +2     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1237,6 +1237,24 @@ export class Profiles extends ProfilesCache {
}
}

public async handleSwitchAuthentication(node?: IZoweNodeType, label?: string): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @SanthoshiBoyina, this is a good start for handling this scenario. We can't assume the profile names. I see the node is passed and not being used, we can use it to get the profile with node.getProfile() which will supply the name of the service profile being used. Once we have that we can check if it has any secure properties and change appropriately at the service profile level then if not there the base type profile level. I believe our ZE API has methods in ProfilesCache to get the base profile that is associated with the service profile to obtain the info and name.

Copy link
Contributor

Choose a reason for hiding this comment

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

If label is not being used I don't see a reason to pass to the method.

SanthoshiBoyina1 and others added 2 commits April 30, 2024 19:34
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
@JillieBeanSim JillieBeanSim self-requested a review May 2, 2024 11:54
Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

I fell into a bit of a circular issue with login to API ML where login was successful and token written correctly then the connection no longer active message showed, when clicking the button I re-login again and it wrote the tokenType & tokenValue to the zosmf profile. very strange behavior
Screenshot 2024-05-02 at 7 53 03 AM

Screenshot 2024-05-02 at 7 53 42 AM

@t1m0thyj t1m0thyj added this to the v2.16.0 milestone May 2, 2024
@zFernand0 zFernand0 mentioned this pull request May 8, 2024
2 tasks
@JillieBeanSim JillieBeanSim linked an issue May 8, 2024 that may be closed by this pull request
@likhithanimma1 likhithanimma1 self-requested a review May 8, 2024 17:41
Copy link
Contributor

@likhithanimma1 likhithanimma1 left a comment

Choose a reason for hiding this comment

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

  1. When I "Login to authentication service" for apimlzosmf the tokenvalue and tokentype are stored in the base profile which is pretty good. But then when "Change the authentication method" is done from token to basic I see the base profile populating with the tokenValue which should be eradicated and the user and pw is being stored in the secure array of apiml profile
Screenshot 2024-05-09 at 12 31 54 AM Screenshot 2024-05-09 at 12 40 31 AM
  1. When the "Login into Authentication service" done twice, for the first time it is populating the base profile with tokenValue and tokenType but for the second time it is populating the profile. Don't know if this comes under scope of this PR. If yes, should be handled.

SanthoshiBoyina1 and others added 2 commits May 10, 2024 00:27
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
@JillieBeanSim
Copy link
Contributor

I recorded some videos of what I am seeing with this branch

Screen.Recording.2024-05-09.at.7.18.48.PM.mov
Screen.Recording.2024-05-09.at.7.16.16.PM.mov

@SanthoshiBoyina
Copy link
Contributor Author

I fell into a bit of a circular issue with login to API ML where login was successful and token written correctly then the connection no longer active message showed, when clicking the button I re-login again and it wrote the tokenType & tokenValue to the zosmf profile. very strange behavior Screenshot 2024-05-02 at 7 53 03 AM

Screenshot 2024-05-02 at 7 53 42 AM

Can you check by adding port number 7554 to the base profile?

@JillieBeanSim
Copy link
Contributor

I fell into a bit of a circular issue with login to API ML where login was successful and token written correctly then the connection no longer active message showed, when clicking the button I re-login again and it wrote the tokenType & tokenValue to the zosmf profile. very strange behavior Screenshot 2024-05-02 at 7 53 03 AM
Screenshot 2024-05-02 at 7 53 42 AM

Can you check by adding port number 7554 to the base profile?

Hey @SanthoshiBoyina, we should be able to handle either instance of port location for the action.

@JillieBeanSim JillieBeanSim modified the milestones: v2.16.0, v2.17.0 May 13, 2024
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
@zFernand0
Copy link
Member

It's possible that reviewers might run into this issue: (re: multiple layers)

Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
traeok
traeok previously requested changes May 23, 2024
Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Looks good so far, thanks @SanthoshiBoyina! I left a couple comments about the "config set" logic and phrasing for the entry in the quick pick.

packages/zowe-explorer/CHANGELOG.md Outdated Show resolved Hide resolved
packages/zowe-explorer/src/Profiles.ts Outdated Show resolved Hide resolved
packages/zowe-explorer/src/Profiles.ts Outdated Show resolved Hide resolved
Signed-off-by: Santhoshi Boyina <Santhoshi.Boyina1@ibm.com>
@traeok traeok dismissed their stale review May 28, 2024 12:57

Changes were recently addressed

Copy link

sonarcloud bot commented May 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
13.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

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

Looks pretty good, thanks @SanthoshiBoyina!

If I have a profile with basic auth, and select the option to Change Authentication Method, then I am presented with a quick pick to choose between user/password or token 👍

image

If I press Escape to cancel out of this quickpick, then I would expect that my profiles should not be changed. However, the basic auth has already been removed from my profile as indicated by the notification below:

image

Could we wait to remove the basic auth from configuration until the point where the user has accepted all input prompts?

@JTonda JTonda requested a review from t1m0thyj May 30, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review/QA
Development

Successfully merging this pull request may close these issues.

Cannot switch from basic auth. to token-based auth.
7 participants