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

[Multi data source] Add interfaces to register add-on authentication method from plug-in module #5851

Merged

Conversation

bandinib-amzn
Copy link
Member

@bandinib-amzn bandinib-amzn commented Feb 8, 2024

Description

This PR adds the interfaces to register authentication method into the registry and get authentication registry. These interfaces are accessible via the setup and start hook in plugin.ts. Any core components or plugins that list dataSource and dataSourceManagement as a dependency will have access to these interfaces.

Issues Resolved

Partially resolves #5692

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (bd75107) 66.95% compared to head (6933ea0) 66.98%.

Files Patch % Lines
...rc/plugins/data_source_management/public/plugin.ts 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5851      +/-   ##
==========================================
+ Coverage   66.95%   66.98%   +0.02%     
==========================================
  Files        3302     3304       +2     
  Lines       63532    63563      +31     
  Branches    10146    10149       +3     
==========================================
+ Hits        42536    42575      +39     
+ Misses      18530    18520      -10     
- Partials     2466     2468       +2     
Flag Coverage Δ
Linux_1 35.21% <ø> (ø)
Linux_2 55.11% <ø> (ø)
Linux_3 43.54% <93.54%> (-0.31%) ⬇️
Linux_4 35.19% <0.00%> (-0.02%) ⬇️
Windows_1 35.24% <ø> (ø)
Windows_2 55.07% <ø> (ø)
Windows_3 43.54% <93.54%> (-0.33%) ⬇️
Windows_4 35.19% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@bandinib-amzn bandinib-amzn changed the title [Multi data source] Adds API to register add-on authentication method from plug-in module [Multi data source] Add interfaces to register add-on authentication method from plug-in module Feb 9, 2024
Signed-off-by: Bandini Bhopi <[email protected]>
@Flyingliuhub
Copy link
Member

Flyingliuhub commented Feb 13, 2024

@bandinib-amzn I saw two ciGroup was still failed, could you please take a look if related to your changes. Thanks

@bandinib-amzn
Copy link
Member Author

ciGroup was still failed, could you please take a look if related to your changes. Thanks

I re-ran failed jobs. After running again, there are two failed jobs. But looks like they are not related to my change.

@bandinib-amzn bandinib-amzn self-assigned this Feb 13, 2024
@bandinib-amzn bandinib-amzn merged commit e08bf30 into opensearch-project:main Feb 13, 2024
74 of 75 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

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

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5851-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e08bf3059896449d2c008059c47b0b3de8da8c9e
# Push it to GitHub
git push --set-upstream origin backport/backport-5851-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

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

*/
public registerAuthenticationMethod(method: AuthenticationMethod) {
if (this.authMethods.has(method.name)) {
throw new Error(`Authentication method '${method.name}' is already registered`);
Copy link
Member

Choose a reason for hiding this comment

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

just to confirm this will fail the OSD bootstrap right? we should ensure OSD won't start if we see duplicated auth methods

Copy link
Member Author

@bandinib-amzn bandinib-amzn Feb 14, 2024

Choose a reason for hiding this comment

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

Just to confirm here you are not talking about yarn osd bootstrap, right?

yarn osd bootstrap is successful.
yarn start fails. But it failing with server crash with following error. That needs to be handled properly. I will handle in following PR.

 FATAL  Error: Authentication method 'my_auth_method' is already registered

 server crashed  with status code 1

@bandinib-amzn bandinib-amzn deleted the register-auth-method branch February 13, 2024 22:02
bandinib-amzn added a commit to bandinib-amzn/OpenSearch-Dashboards that referenced this pull request Feb 14, 2024
…method from plug-in module (opensearch-project#5851)

* Adds method to register credential provider during data source plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds method to register authentication method with UI elements during data source management plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source management plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for data_source_management plugin.ts

Signed-off-by: Bandini Bhopi <[email protected]>

* Refactor code

Signed-off-by: Bandini Bhopi <[email protected]>

---------

Signed-off-by: Bandini Bhopi <[email protected]>
(cherry picked from commit e08bf30)
bandinib-amzn added a commit to bandinib-amzn/OpenSearch-Dashboards that referenced this pull request Feb 20, 2024
…method from plug-in module (opensearch-project#5851)

* Adds method to register credential provider during data source plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds method to register authentication method with UI elements during data source management plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source management plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for data_source_management plugin.ts

Signed-off-by: Bandini Bhopi <[email protected]>

* Refactor code

Signed-off-by: Bandini Bhopi <[email protected]>

---------

Signed-off-by: Bandini Bhopi <[email protected]>
(cherry picked from commit e08bf30)
Flyingliuhub pushed a commit that referenced this pull request Feb 20, 2024
…method from plug-in module (#5851) (#5874)

* Adds method to register credential provider during data source plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds method to register authentication method with UI elements during data source management plugin setup

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for auth registry in data source management plugin

Signed-off-by: Bandini Bhopi <[email protected]>

* Adds UT for data_source_management plugin.ts

Signed-off-by: Bandini Bhopi <[email protected]>

* Refactor code

Signed-off-by: Bandini Bhopi <[email protected]>

---------

Signed-off-by: Bandini Bhopi <[email protected]>
(cherry picked from commit e08bf30)
@zhongnansu zhongnansu added the multiple datasource multiple datasource project label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Refactoring data source plugin to support add-on authentication method with plug-in module
7 participants