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

Hide/Show authentication method in multi data source plugin based on configuration #5916

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
333987f
[AuthType Config] Add EnabledAuthType configuration in yml file and p…
xinruiba Feb 20, 2024
5327710
[AuthType Config] provide default auth types when types array is empty
xinruiba Feb 20, 2024
cc91319
[AuthRegistry Onboard - DataSourceCreationForm] Integrate auth cofig …
xinruiba Feb 22, 2024
0339047
[AuthRegistry Onboard] Support default selected auth type in datasour…
xinruiba Feb 23, 2024
9b138fe
[AuthRegistry Onboard] SDisable auth option selector when auth option…
xinruiba Feb 23, 2024
f0b4c88
[AuthRegistry Onboard] clear credential attribute every time use sele…
xinruiba Feb 23, 2024
c6bb34c
Merge branch 'opensearch-project:main' into xinrui_AuthMethod_Config
xinruiba Feb 23, 2024
1ebd2e2
Update yml file to disable config
xinruiba Feb 23, 2024
91e734e
Update change.md file
xinruiba Feb 23, 2024
fc0369e
[UT] Fix broken test cases
xinruiba Feb 23, 2024
2bf8abe
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 23, 2024
f0201ef
[UT] Add more unit tests
xinruiba Feb 23, 2024
ae1b8c8
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 23, 2024
246b1d3
Merge branch 'opensearch-project:main' into xinrui_AuthMethod_Config
xinruiba Feb 26, 2024
551f87a
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 27, 2024
c2da4e2
[UT] update unit test and handle scenario when no options enabled
xinruiba Feb 27, 2024
8f2c75a
[UT] update description of unit test case
xinruiba Feb 27, 2024
6d7463e
[UT] update unit test cases to resolve comment
xinruiba Feb 27, 2024
f11cebf
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 27, 2024
b0b1918
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 27, 2024
9d39598
[UT] Snapshot auth option super selector for unit test. Also upate th…
xinruiba Feb 27, 2024
070195d
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 27, 2024
39f77b9
Merge branch 'main' into xinrui_AuthMethod_Config
xinruiba Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Multiple Datasource] Concatenate data source name with index pattern name and change delimiter to double colon ([#5907](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5907))
- [Multiple Datasource] Refactor client and legacy client to use authentication registry ([#5881](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5881))
- [Multiple Datasource] Improved error handling for the search API when a null value is passed for the dataSourceId ([#5882](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5882))
- [Multiple Datasource] Hide/Show authentication method in multi data source plugin based on configuration ([#5916](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5916))

### 🐛 Bug Fixes

Expand Down
11 changes: 11 additions & 0 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@
# 'ff00::/8',
# ]

# Set enabled false to hide authentication method in OpenSearch Dashboards.
# If this setting is commented then all 3 options will be available in OpenSearch Dashboards.
# Default value will be considered to True.
#data_source.authTypes:
xinruiba marked this conversation as resolved.
Show resolved Hide resolved
# NoAuthentication:
# enabled: true
# UsernamePassword:
# enabled: true
# AWSSigV4:
# enabled: true

# Set the value of this setting to false to hide the help menu link to the OpenSearch Dashboards user survey
# opensearchDashboards.survey.url: "https://survey.opensearch.org"

Expand Down
11 changes: 11 additions & 0 deletions src/plugins/data_source/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export const configSchema = schema.object({
appender: fileAppenderSchema,
}),
endpointDeniedIPs: schema.maybe(schema.arrayOf(schema.string())),
authTypes: schema.object({
NoAuthentication: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
UsernamePassword: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
AWSSigV4: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
}),
});

export type DataSourcePluginConfigType = TypeOf<typeof configSchema>;
6 changes: 6 additions & 0 deletions src/plugins/data_source/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc
return {
dataSourceEnabled: config.enabled,
hideLocalCluster: config.hideLocalCluster,
noAuthenticationTypeEnabled: config.authTypes.NoAuthentication.enabled,
usernamePasswordAuthEnabled: config.authTypes.UsernamePassword.enabled,
awsSigV4AuthEnabled: config.authTypes.AWSSigV4.enabled,
};
}

Expand All @@ -30,6 +33,9 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc
return {
dataSourceEnabled: config.enabled,
hideLocalCluster: config.hideLocalCluster,
noAuthenticationTypeEnabled: config.authTypes.NoAuthentication.enabled,
usernamePasswordAuthEnabled: config.authTypes.UsernamePassword.enabled,
awsSigV4AuthEnabled: config.authTypes.AWSSigV4.enabled,
};
}

Expand Down
6 changes: 6 additions & 0 deletions src/plugins/data_source/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
export interface DataSourcePluginSetup {
dataSourceEnabled: boolean;
hideLocalCluster: boolean;
noAuthenticationTypeEnabled: boolean;
usernamePasswordAuthEnabled: boolean;
awsSigV4AuthEnabled: boolean;
}

export interface DataSourcePluginStart {
dataSourceEnabled: boolean;
hideLocalCluster: boolean;
noAuthenticationTypeEnabled: boolean;
usernamePasswordAuthEnabled: boolean;
awsSigV4AuthEnabled: boolean;
}
1 change: 1 addition & 0 deletions src/plugins/data_source/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const config: PluginConfigDescriptor<DataSourcePluginConfigType> = {
exposeToBrowser: {
enabled: true,
hideLocalCluster: true,
authTypes: true,
xinruiba marked this conversation as resolved.
Show resolved Hide resolved
},
schema: configSchema,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { EuiSuperSelectOption } from '@elastic/eui';

export interface AuthenticationMethod {
name: string;
credentialForm: React.JSX.Element;
credentialSourceOption: EuiSuperSelectOption<string>;
credentialForm?: React.JSX.Element;
crendentialFormField?: { [key: string]: string };
}

export type IAuthenticationMethodRegistery = Omit<
Expand Down
Loading
Loading