You are here

public static function DESConnector81::setAuthentication in Elasticsearch Connector 8

Sets the HTTP authentication options.

Parameters

array $options: Array with the options to pass to the Elasticsearch Client.

array $host: Array with the host options as provided from the Cluster form.

1 call to DESConnector81::setAuthentication()
DESConnector81::getInstance in src/DESConnector/DESConnector81.php
Initializes the needed client.

File

src/DESConnector/DESConnector81.php, line 114
Provides Elasticsearch Client for Drupal's Elasticsearch Connector module.

Class

DESConnector81
Drupal Elasticsearch Interface.

Namespace

Drupal\elasticsearch_connector\DESConnector

Code

public static function setAuthentication(&$options, $host) {
  if (!empty($host['options']['use_authentication'])) {
    $options['connectionParams'] = array(
      'auth' => array(
        $host['options']['username'],
        $host['options']['password'],
        $host['options']['authentication_type'],
      ),
    );
  }
}