Merge pull request #1262 from tirongi/feature/elasticCustomURLBasicAuth

Enable inserting custom URL  using basic auth
This commit is contained in:
Henry Heng
2023-11-21 23:37:19 +00:00
committed by GitHub
2 changed files with 22 additions and 9 deletions
@@ -11,8 +11,8 @@ class ElasticSearchUserPassword implements INodeCredential {
this.label = 'ElasticSearch User Password'
this.name = 'elasticSearchUserPassword'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://www.elastic.co/guide/en/kibana/current/tutorial-secure-access-to-kibana.html">official guide</a> on how to get User Password from ElasticSearch'
this.description = `Use Cloud ID field to enter your Elastic Cloud ID or the URL of the Elastic server instance.
Refer to <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-up-authentication.html">official guide</a> on how to get User Password from ElasticSearch.`
this.inputs = [
{
label: 'Cloud ID',
@@ -144,13 +144,26 @@ export abstract class ElasticSearchBase {
} else if (cloudId) {
let username = getCredentialParam('username', credentialData, nodeData)
let password = getCredentialParam('password', credentialData, nodeData)
elasticSearchClientOptions = {
cloud: {
id: cloudId
},
auth: {
username: username,
password: password
if (cloudId.startsWith('http')) {
elasticSearchClientOptions = {
node: cloudId,
auth: {
username: username,
password: password
},
tls: {
rejectUnauthorized: false
}
}
} else {
elasticSearchClientOptions = {
cloud: {
id: cloudId
},
auth: {
username: username,
password: password
}
}
}
}