OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[MD] Support test connection when creating datasource

Open zhongnansu opened this issue 2 years ago • 1 comments

zhongnansu avatar Sep 28 '22 20:09 zhongnansu

there isn't an OpenSearch API that can be used to verify the connection/authentication. While I think we can leverage the authInfo API provided by the security plugin to verify the authentication if the data source has auth enabled. So the logic of the test connection is

  • if user choose username password auth type, attempt to call the authInfo API of the data source, the test operation success if getting 2xx response, otherwise the test fail
  • if user choose no auth for the data source, call the cluster info API /. if getting 2xx response, the test success, otherwise the test fail

This will require a new API in data source plugin for test connection function. And in the case of users wants to connect to a non-Opensearch endpoint, like Elasticsearch with x-pack security which supports basic auth, this test connection will not work even though the username and password is valid and it could run query against that data source

zengyan-amazon avatar Sep 29 '22 22:09 zengyan-amazon

https://opensearch.org/docs/1.3/security-plugin/access-control/api/#account

mpabba3003 avatar Nov 15 '22 00:11 mpabba3003

Update: we can try connecting to the cluster info API as well when there is auth. And only look for 401 Unauthorized error to check if the provided auth is invalid.

kristenTian avatar Nov 19 '22 01:11 kristenTian

Update: we can try connecting to the cluster info API as well when there is auth. And only look for 401 Unauthorized error to check if the provided auth is invalid.

I think per @zengyan-amazon 's point, to suggest using security plugin api, e.g. _plugin/authInfo, is to make sure when user tries to connect to ES cluster, it's with only our security plugin installed, not x-pack security. Also why not check for 200? Don't we want a "test connection" to test successful connection at the moment? Checking 401 can only make sure the auth is correct, but I doubt it's equal with 200.

zhongnansu avatar Nov 22 '22 18:11 zhongnansu

can this be closed by: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2973 @zhongnansu

kavilla avatar Dec 13 '22 16:12 kavilla

can this be closed by: #2973 @zhongnansu

Yes

zhongnansu avatar Dec 13 '22 18:12 zhongnansu

Feedback from our review of the latest implantation:

MDS Create flow - test connection UX

  • Differentiate messages between a username/password error vs an error reaching the cluster
  • Message for Username/Password error: "Username or password is incorrect."
  • Error reaching the endpoint: "Failure connecting to endpoint."
  • Change button copy "Text Connection" to "Test connection"

MDS detail page - test connection UX

  • Differentiate messages between a username/password error vs an error reaching the cluster
  • Message for Username/Password error: "Username or password is incorrect."
  • Error reaching the endpoint: "Failure connecting to endpoint."
  • Change button copy "Test Connection" to "Test connection"

Non blocking feedback (to add to the project roadmap):

  • Update the change password flow according to designs in Figma
  • When a user successfully completes a connection test, change the state of Test connection button to a success state (EuiIcon="check") See guidance in "Toggle buttons -> Change visual appearance" & use color euiColorSuccess

KrooshalUX avatar Jan 07 '23 00:01 KrooshalUX