-
Notifications
You must be signed in to change notification settings - Fork 163
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
Preserve URL Hash for SAML based login #1039
Conversation
Signed-off-by: Deepak Devarakonda <[email protected]>
Revert "Replace _opendistro route with _plugins (#895)" (#1035) Signed-off-by: Deepak Devarakonda <[email protected]>
cc: @varun-lodaya |
Codecov Report
@@ Coverage Diff @@
## main #1039 +/- ##
=======================================
Coverage 72.27% 72.27%
=======================================
Files 87 87
Lines 1915 1915
Branches 244 244
=======================================
Hits 1384 1384
Misses 478 478
Partials 53 53 Help us with your feedback. Take ten seconds to tell us how you rate us. |
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.
Great Addition! One small request, can you add one-liner comments to explain the functionality you added in routes.ts
Signed-off-by: Deepak Devarakonda <[email protected]>
@DarshitChanpura, I have added comments. |
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 this contribution - is there a reason you'd like to add the test cases in a separate PR? I'd like to merge this fix with its associated tests at once
peternied@ the plugin does not have a SAML integration test framework currently. Adding a new framework to handle redirects is very involved. devardee@ has started some work but it's taking longer than expected and we don't want to block this while waiting on the framework. |
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 know the manual steps were called out in the PR description, but we don't have the capacity or process to execute manual test cases, this change needs to wait until there is a way to validate it works.
Without such validation the functionality could easily be broken and we would not know why. There was a mention of trouble getting the tests up and running, please open a draft PR if you'd like to brainstorm on how to make progress in this space before adding those changes to this PR.
About the SAML testing, when we setup the cluster for integration testing a docker instance is used for OpenSearch. By expanding on the docker-compose example with a test SAML IdP this might be an easier to integrate into tests into the CI systems see link. |
server/auth/types/saml/routes.ts
Outdated
}, | ||
}); | ||
if (redirectHash) { | ||
console.log('The server base path is : ' + this.coreSetup.http.basePath.serverBasePath); |
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.
Please remove this if not needed.
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.
ack
Signed-off-by: Deepak Devarakonda <[email protected]>
@peternied , @DarshitChanpura and @cliu123 I have addressed the comments, can you please take another look |
#1044 is nearly there, lets get those updates and include them in this PR so we can merge everything at once. |
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.
Merging, seperately we will see about getting the tests integrated
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8)
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8) Co-authored-by: Deepak Devarakonda <[email protected]>
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8)
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8) Co-authored-by: Deepak Devarakonda <[email protected]>
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8) Signed-off-by: Aniketh Jain <[email protected]>
* Preserve URL HASH after user logs via SAML IDP Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit a9d10d8)
* SAML Integration Tests (#1088) * Preserve URL Hash for SAML based login (#1039) * Preserve URL HASH after user logs via SAML IDP Signed-off-by: Deepak Devarakonda <[email protected]> Signed-off-by: Aniketh Jain <[email protected]> Signed-off-by: Craig Perkins <[email protected]> Co-authored-by: anijain-Amazon <[email protected]> Co-authored-by: Deepak Devarakonda <[email protected]> Co-authored-by: Deepak Devarakonda <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]>
…)" This reverts commit a9d10d8.
Description
In Opensearch Dashboards URL Hash encodes the state of a visualization (state could be the filters to apply, the time range etc). Currently for SAML based authentication when User logins-for-the-first-time/re-authenticates the url hash is being dropped because of redirecting to the IDP. This PR ensures that URL Hash is preserved after authenticating with the IDP.
Old Closed PR for reference : #1001.
Category
Enhancement
Why these changes are required?
This PR ensures that state of visualization remains consistent after authenticating via IDP.
What is the old behavior before changes and new behavior after changes?
In the old behavior when the dashboard plugin redirects browser to IDP the hash is lost and User looses their unsaved work. In the new behavior, before redirecting to IDP the dashboard plugin will store the hash in browser's local storage, later after the User is authenticated the hash is restored from the browser's local storage.
Issues Resolved
#543 and #831
Testing
Intergation Testing:
Manual Testing:
To Test the flow manually we need 3 servers.
[email protected]
is the default username, that can be changed in the config of the IDP. PATCH Request to map all_access role to that user for testing purpose.HAR File:
SamlHashPreserve.har.zip
Video demonstrating the flow:
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.