OpenSearch-Dashboards
OpenSearch-Dashboards copied to clipboard
[MD] Support test connection when creating datasource
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
https://opensearch.org/docs/1.3/security-plugin/access-control/api/#account
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.
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.
can this be closed by: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2973 @zhongnansu
can this be closed by: #2973 @zhongnansu
Yes
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 coloreuiColorSuccess