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.label = 'ElasticSearch User Password'
this.name = 'elasticSearchUserPassword' this.name = 'elasticSearchUserPassword'
this.version = 1.0 this.version = 1.0
this.description = 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/kibana/current/tutorial-secure-access-to-kibana.html">official guide</a> on how to get User Password from ElasticSearch' 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 = [ this.inputs = [
{ {
label: 'Cloud ID', label: 'Cloud ID',
@@ -144,6 +144,18 @@ export abstract class ElasticSearchBase {
} else if (cloudId) { } else if (cloudId) {
let username = getCredentialParam('username', credentialData, nodeData) let username = getCredentialParam('username', credentialData, nodeData)
let password = getCredentialParam('password', credentialData, nodeData) let password = getCredentialParam('password', credentialData, nodeData)
if (cloudId.startsWith('http')) {
elasticSearchClientOptions = {
node: cloudId,
auth: {
username: username,
password: password
},
tls: {
rejectUnauthorized: false
}
}
} else {
elasticSearchClientOptions = { elasticSearchClientOptions = {
cloud: { cloud: {
id: cloudId id: cloudId
@@ -154,6 +166,7 @@ export abstract class ElasticSearchBase {
} }
} }
} }
}
return elasticSearchClientOptions return elasticSearchClientOptions
} }