-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix logout to give base profile precedence over parent profile #3076
Conversation
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #3076 +/- ##
==========================================
+ Coverage 92.57% 92.59% +0.02%
==========================================
Files 113 113
Lines 11638 11660 +22
Branches 2570 2488 -82
==========================================
+ Hits 10774 10797 +23
+ Misses 862 861 -1
Partials 2 2 ☔ 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.
These changes LGTM, thanks @t1m0thyj for the fix!
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.
Changes makes sense to me 😋
I left a comment, however this is all theoretical, so it might be nice to discuss offline (or during standup)
packages/zowe-explorer-api/__tests__/__unit__/profiles/ProfilesCache.unit.test.ts
Show resolved
Hide resolved
Signed-off-by: Trae Yelovich <trae.yelovich@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
…nto fix/multi-apiml-logout Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Initial concerned was discussed and addressed in 4f24050
…nto fix/multi-apiml-logout Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
…nto fix/multi-apiml-logout Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
…ined in the IProfile Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
📅 Suggested merge-by date: 9/30/2024 |
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! 😋
Not sure if I should be approving as this is something that I was very closely watching (and at times "fixing" tests for)
// Note: It should be expected that nested profiles within this service profile will have their credentials updated. | ||
const profIndex = cache.allProfiles.findIndex((profile) => profile.name === opts.serviceProfile.name); | ||
cache.allProfiles[profIndex] = opts.serviceProfile; | ||
cache.allProfiles[profIndex] = { ...cache.allProfiles[profIndex], profile: opts.serviceProfile.profile }; |
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.
Thanks for fixing.
This seems to keep the name and type of serviceProfile in the cache, while updating the contents of the profiles (say with tokenType and tokenValue).
// it("should prefer base profile when it exists and it has tokenValue in secure array", async () => {}); | ||
// it("should prefer base profile when it exists, it does not have tokenValue in its secure array, and service profile is flat", async () => {}); | ||
// it("should prefer parent profile when base profile does not exist and service profile is nested", () => {}); | ||
// it("should cancel the operation if the base profile does not exist and service profile is flat", () => {}); |
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.
Thanks for adding this set of "e2e" tests 🙏🏽
this.log.error(error as string); | ||
const mProfileInfo = await this.getProfileInfo(); | ||
if (!mProfileInfo.getTeamConfig().exists) { | ||
return; | ||
} | ||
const allTypes = this.getAllProfileTypes(apiRegister?.registeredApiTypes() ?? []); |
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.
Seems like the workaround above was not being used after the merge from next?
either way, thanks for cleaning it up 🙏🏽
* If there is no API registered for the profile type, this method defaults the login behavior to that of the APIML. | ||
* @param {BaseProfileAuthOptions} opts Object defining options for base profile authentication | ||
*/ | ||
public static async ssoLogin(opts: BaseProfileAuthOptions): 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.
I completely missed that this would've been a breaking change to extenders.
Great catch! 🙏🏽
Thanks for deprecating the old login/-out function in favor of the new ssoLogin/-out 🥳
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.
Changes LGTM, thanks @t1m0thyj and @zFernand0 😋
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Quality Gate failedFailed conditions |
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! 🙏🏽
Proposed changes
Follow up to #3019 - fixes behavior of logout action when token is defined in both base profile and parent profile.
TODO:
Release Notes
Milestone: V3
Changelog: TBD
Types of changes
Checklist
General
yarn workspace vscode-extension-for-zowe vscode:prepublish
pnpm --filter vscode-extension-for-zowe vscode:prepublish
Code coverage
Deployment
Further comments