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 #5694

Closed
Tracked by #5752
bandinib-amzn opened this issue Jan 16, 2024 · 7 comments
Assignees
Labels
dashboards anywhere label for dashboards anywhere enhancement New feature or request multiple datasource multiple datasource project v2.13.0

Comments

@bandinib-amzn
Copy link
Member

bandinib-amzn commented Jan 16, 2024

Is your feature request related to a problem? Please describe.

Yes, I wanted to customize authentication methods in multi data source plugin. Sometime I don't need particular auth method to be supported in multi data source plugin because of security or any other concern. I should have flexibility to show only authentication method which I wanted.

Also if there is only one option for selection, make dropdown or selection option read only.

Describe the solution you'd like

Add configuration in yml file and hide/show the auth options based on configuration.

@bandinib-amzn bandinib-amzn added enhancement New feature or request v2.13.0 labels Jan 16, 2024
@bandinib-amzn bandinib-amzn added multiple datasource multiple datasource project dashboards anywhere label for dashboards anywhere and removed untriaged labels Jan 16, 2024
@zengyan-amazon
Copy link
Member

in addition to hide/show authentication methods, we only support basic auth(username/password) and static IAM credentials authentication methods. We may consider to make it easier for developers to add other auth methods via plugin, e.g. supporting API key etc.

@bandinib-amzn
Copy link
Member Author

Right now we are supporting No Authentication, Basic Authentication(username/password) and AWS SigV4 (static IAM credentials) authentication methods. Although we propose to add interface in multi data source plugin to register authentication method by plugin in #5692, it would be too many plugins if we decide to move each authentication method in plugins. That's why I feel we should keep existing auth methods as part of core code and provide config options to manage them (hid/show).

I'll mark this issue as follow up item in #5692

@bandinib-amzn
Copy link
Member Author

  1. To achieve requested feature, we can add configuration as below:
# 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:
  NoAuthentication:
    enabled: true
  UsernamePassword:
    enabled: true
  AWSSigV4:
    enabled: true

Please feel free to optimize/modify as per your preference

  1. During data_source_management plugin setup, read config values and register authentication methods in auth registry.

  2. Refactor below code, to read authentication option from registry.

    <EuiSuperSelect
    options={credentialSourceOptions}
    valueOfSelected={this.state.auth.type}
    onChange={(value) => this.onChangeAuthType(value)}
    name="Credential"
    data-test-subj="createDataSourceFormAuthTypeSelect"
    />

  3. Add readOnly prop to above super select component. readOnly value should be true if there is only one option in auth registry.

@bandinib-amzn
Copy link
Member Author

@xinruiba Can you take a look at this and help? Thanks!

@xinruiba
Copy link
Member

@bandinib-amzn Sure, happy to work on it.

@xinruiba
Copy link
Member

The readOnly prop is not works as expected in <EuiSuperSelect>.
https://oui.opensearch.org/1.3/#/forms/super-select

Would you mind to help us understand the expected behavior when readOnly prop is set to true? @kgcreative

Since readOnly is not works, we decide to move forward with the "disabled" prop:

Screenshot 2024-02-22 at 4 38 18 PM

@xinruiba
Copy link
Member

xinruiba commented Feb 28, 2024

This one get completed in PR #5976. We should be able to mark it as complete. @bandinib-amzn . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboards anywhere label for dashboards anywhere enhancement New feature or request multiple datasource multiple datasource project v2.13.0
Projects
None yet
Development

No branches or pull requests

3 participants