Skip to content

Initial commit for multiple authentication#1110

Merged
cliu123 merged 60 commits intoopensearch-project:mainfrom
aoguan1990:multiple_auth_type
Oct 28, 2022
Merged

Initial commit for multiple authentication#1110
cliu123 merged 60 commits intoopensearch-project:mainfrom
aoguan1990:multiple_auth_type

Conversation

@aoguan1990
Copy link
Copy Markdown
Contributor

@aoguan1990 aoguan1990 commented Sep 23, 2022

Signed-off-by: Aozixuan Priscilla Guan aoguan@amazon.com

Description

The purpose of this project is to leverage functionalities to allow OpenSearch Dashboards (OSD) users to Login/ Logout from the integrated Login/Logout UI with different authentication methodologies. OSD administer can enable single or multiple authentication type(s) on demand by setting up OpenSearch Dashboards configuration YML. For OpenSearch Dashboards with Security Plugin enabled, at least one authentication type is required.

Category

[New Feature]

Why these changes are required?

As for now, OpenSearch Dashboards supports many types of authentications including Basic, OIDC, SAML, LDAP, Proxy and Client-Certificate based authentication. However, only one authentication type can be configured in OpenSearch Dashboard while there is a high demand shows the opposite way. After capturing and analyzing customer requests from both GitHub and OpenSearch Community, the great value of enabling multiple authentication types simultaneously in OpenSearch Dashboards is self-evident.

Related Customer Request

GitHub Issues:
#1112
#2099
#74

OpenSeach Community Issues:
#354
#3164
#10553
#10233
#7015

What is the old behavior before changes and new behavior after changes?

Currently, OpenSearch Dashboards only allows users to login with single authentication type. Users can either use built-in login with username and password, or use single sign-on with external SAML/OIDC IDP. The following pain-points are observed:

  • OpenSearch Dashboards does not support users to login with built-in login and single sign-on approaches simultaneously
  • OpenSearch Dashboards does not provide built-in Login UI for single sign-on approach

In order to address the pain-points, this project proposes to utilize integrated and customizable Login/Logout UI to allow users to login/logout OpenSearch Dashboards with multiple authentication types, including Basic, SAML, OIDC and Anonymous.

Issues Resolved

Testing

[unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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.

@aoguan1990 aoguan1990 requested a review from a team September 23, 2022 02:29
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 23, 2022

Codecov Report

❌ Patch coverage is 62.82051% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.82%. Comparing base (6236fe2) to head (4165aba).
⚠️ Report is 285 commits behind head on main.

Files with missing lines Patch % Lines
public/apps/login/login-page.tsx 80.39% 6 Missing and 4 partials ⚠️
public/apps/account/utils.tsx 0.00% 9 Missing ⚠️
public/apps/account/account-app.tsx 44.44% 3 Missing and 2 partials ⚠️
public/apps/account/log-out-button.tsx 66.66% 2 Missing ⚠️
public/utils/logout-utils.tsx 0.00% 2 Missing ⚠️
public/plugin.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1110      +/-   ##
==========================================
- Coverage   72.07%   71.82%   -0.26%     
==========================================
  Files          88       88              
  Lines        1959     2023      +64     
  Branches      258      268      +10     
==========================================
+ Hits         1412     1453      +41     
- Misses        490      508      +18     
- Partials       57       62       +5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cliu123
Copy link
Copy Markdown
Member

cliu123 commented Sep 23, 2022

CI failed.
@peterzhuamazon Is 2.4.0 security plugin artifact available?

aoguan1990 and others added 7 commits September 26, 2022 16:16
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
This reverts commit 892180f508e2fabb31030de5d1178cf68c7820f2.

Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Ryan Liang <jiallian@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
* Refactor + add support to run saml based integ tests via selenium web driver

Signed-off-by: Deepak Devarakonda <devardee@amazon.com>

* Add plugins.security.unsupported.restapi.allow_securityconfig_modification in developer guide

Signed-off-by: Deepak Devarakonda <devardee@amazon.com>

* Add one more test

Signed-off-by: Deepak Devarakonda <devardee@amazon.com>

* Added tests for checking tenancy retention after logout in SAML

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Lint formatting fixes

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Removed unused imports

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Add plugins.security.unsupported.restapi.allow_securityconfig_modification in developer guide

Signed-off-by: Deepak Devarakonda <devardee@amazon.com>

* Added License header

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added building the plugin bundles while running ITs

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Signed off the commit

Removed a comment no longer required

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added debug loggers for checking IT failures

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added debug loggers for checking IT failures

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added debug loggers for checking IT failures

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added debug loggers for checking IT failures

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added a new stage for debug loggers before cleanup

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added a new stage for debug loggers before cleanup

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added logger to print error recieved from auth info during saml login

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added Docker host N/W Config to allow connection to SAML IDP

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added discovery type config to be single node for passing bootstrap checks

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Debug loggers

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Debug loggers

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Debug loggers

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Reverted run command to see change in error

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Trying with full docker image of OS

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Refactored the integration test yaml to use OS Full Docker image

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Removed all debug loggers

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added selfSigned package for generating certs and integrated with saml-idp

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Deleted checked-in key and cert for saml-idp server

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Reverted use of docker image and testing again with manual build

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Reverted use of docker image and testing again with manual build

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Upgraded version from 2.3 to 2.4

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Removed debug pointers

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Commented out failing IT temporarily

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Lint formatting fix

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added the commented failing test back again

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Removed assertion from test again to make it pass

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Used a better XPath and improved error logging in tests

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Removed an unused XPath

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added back the assertion for failing IT

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Added steps to run Selenium based Integ Tests

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Commented out the test, will re-enable it again in the fix PR

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

* Parameterized the getDriver function

Signed-off-by: Aniketh Jain <anijainc@amazon.com>

Signed-off-by: Deepak Devarakonda <devardee@amazon.com>
Signed-off-by: Aniketh Jain <anijainc@amazon.com>
Co-authored-by: Deepak Devarakonda <devardee@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
aoguan1990 and others added 6 commits September 27, 2022 10:15
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
aoguan1990 and others added 6 commits September 28, 2022 13:48
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Copy link
Copy Markdown
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Great feature for Dashboard users - thanks for this effort!

I think you found some problems with the previous conventions where switch/casing is used instead of something like an 'authentication handler' interface. This is causing lots of potential gaps where functionality could be missing / broken and its hard to know if it is being exercised. Lets look at a couple of this places with different behavior patterns and see if we can generalize. Then a single auth handler or multiple will look identical at the different code touchpoints and it will be trivial to add more auth types in the future.

Note; I only managed to review ~50% of the file so I might have more feedback when I get time to do the final pass

@aoguan1990 aoguan1990 requested a review from peternied October 4, 2022 04:19
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
@aoguan1990 aoguan1990 requested review from cliu123 and removed request for expani October 28, 2022 15:33
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>
@cliu123 cliu123 merged commit eee08a5 into opensearch-project:main Oct 28, 2022
@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1110-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 eee08a5f1d91850c741a0085ea5f2beccaf0c343
# Push it to GitHub
git push --set-upstream origin backport/backport-1110-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1110-to-2.x.

@cliu123 cliu123 added backport 2.x backport to 2.x branch backport 2.4 backport to 2.4 branch and removed backport 2.x backport to 2.x branch labels Oct 28, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 3, 2022
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>

Co-authored-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com>
Co-authored-by: anijain-Amazon <110471048+anijain-Amazon@users.noreply.github.com>
Co-authored-by: Deepak Devarakonda <devardee@amazon.com>
Co-authored-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit eee08a5)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 3, 2022
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>

Co-authored-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com>
Co-authored-by: anijain-Amazon <110471048+anijain-Amazon@users.noreply.github.com>
Co-authored-by: Deepak Devarakonda <devardee@amazon.com>
Co-authored-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit eee08a5)
RyanL1997 added a commit that referenced this pull request Nov 3, 2022
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>

Co-authored-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com>
Co-authored-by: anijain-Amazon <110471048+anijain-Amazon@users.noreply.github.com>
Co-authored-by: Deepak Devarakonda <devardee@amazon.com>
Co-authored-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit eee08a5)
RyanL1997 added a commit that referenced this pull request Nov 3, 2022
Signed-off-by: Aozixuan Priscilla Guan <aoguan@amazon.com>

Co-authored-by: Craig Perkins <cwperx@amazon.com>
Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com>
Co-authored-by: anijain-Amazon <110471048+anijain-Amazon@users.noreply.github.com>
Co-authored-by: Deepak Devarakonda <devardee@amazon.com>
Co-authored-by: Chang Liu <lc12251109@gmail.com>
(cherry picked from commit eee08a5)
@cwperks cwperks mentioned this pull request Nov 3, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.x backport to 2.x branch backport 2.4 backport to 2.4 branch v2.4.0 'Issues and PRs related to version v2.4.0'

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature-Proposal] Enable Multiple Authentication for OpenSearch Dashboard