-
Notifications
You must be signed in to change notification settings - Fork 159
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
When following a link that prompts sign in through SAML or Multi-Auth the destination page is not lost #1557
When following a link that prompts sign in through SAML or Multi-Auth the destination page is not lost #1557
Conversation
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1557 +/- ##
==========================================
+ Coverage 66.06% 66.18% +0.11%
==========================================
Files 93 93
Lines 2328 2339 +11
Branches 310 312 +2
==========================================
+ Hits 1538 1548 +10
Misses 722 722
- Partials 68 69 +1
|
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.
Good find - encoding issues are something else.
public/apps/login/login-page.tsx
Outdated
renderLoginButton(AuthType.SAML, SAML_AUTH_LOGIN_WITH_FRAGMENT, samlConfig) | ||
); | ||
const urlParams = new URLSearchParams(window.location.search); | ||
let nextUrl = urlParams.get('nextUrl'); |
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.
Confusing to see this variable assigned values multiple times.
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 function should be simpler now. I reduced the amount of usages of nextUrl
public/apps/login/login-page.tsx
Outdated
formBodyOp.push( | ||
renderLoginButton(AuthType.SAML, SAML_AUTH_LOGIN_WITH_FRAGMENT, samlConfig) | ||
); | ||
const urlParams = new URLSearchParams(window.location.search); |
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 this new logic be broken out into a function, I think that could help clarify while this block is doing and keep its logic isolated
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 abstracted this out into a function in login-utils
Signed-off-by: Craig Perkins <[email protected]>
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.
Other than Peter's comment about extracting the code block into the function this looks good to me. Nice job with the tests.
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Unit tests CI fails due to linter errors. Once those are fixed via #1558, I'll add my approval. |
Signed-off-by: Craig Perkins <[email protected]>
…erks/security-dashboards-plugin into fix-multi-auth-saml-next-url
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@DarshitChanpura @peternied @scrawfor99 This is ready for review again after the PR to remove hardcoded colors was merged. |
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 @cwperks !
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.
Hi @cwperks, thanks for putting them together. I apologize for the late review. I just left some questions/comments.
Signed-off-by: Craig Perkins <[email protected]>
1a994d4
@RyanL1997 We still have the saml_auth tests they are just skipped on windows because of the issue bringing up the node-based IdP on the Github Windows runner. |
Yes, I know that. I was just confusing for a second when I see that line change haha. But I get it now. Thanks |
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.
@cwperks Thanks for adding the unit test. This is looking good to me.
#1557) * Fix bug with nextUrl using SAML and multiauth enabled Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit f655ccf)
#1557) (#1561) * Fix bug with nextUrl using SAML and multiauth enabled Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit f655ccf) Co-authored-by: Craig Perkins <[email protected]>
Description
Fixes a bug with nextUrl and SAML when multiauth is enabled. The SAML login button was not correctly carrying the nextUrl from the URL after logging in and instead routing the user to the home page.
Now the user will be routed to where they previously were before their session timed out or if they log off.
Category
Bug fix
Issues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.