Skip to content

Commit 5162667

Browse files
committed
rename apikey auth method
1 parent ae19c2c commit 5162667

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/Elasticsearch/ClientBuilder.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,20 +336,6 @@ public function setHosts(array $hosts): ClientBuilder
336336
return $this;
337337
}
338338

339-
/**
340-
* Set the APIKey for Authenication
341-
*
342-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
343-
*
344-
* @param string $apiKey
345-
*/
346-
public function setApiKeyAuthentication(string $apiKey)
347-
{
348-
$this->connectionParams['client']['headers']['Authorization'] = ['ApiKey ' . $apiKey];
349-
350-
return $this;
351-
}
352-
353339
/**
354340
* Set the APIKey Pair, consiting of the API Id and the ApiKey of the Response from /_security/api_key
355341
*
@@ -358,9 +344,11 @@ public function setApiKeyAuthentication(string $apiKey)
358344
* @param string $id
359345
* @param string $apiKey
360346
*/
361-
public function setApiKeyPairAuthentication(string $id, string $apiKey)
347+
public function setApiKey(string $id, string $apiKey)
362348
{
363-
$this->setApiKeyAuthentication(base64_encode($id . ':' . $apiKey));
349+
$this->connectionParams['client']['headers']['Authorization'] = [
350+
'ApiKey ' . base64_encode($id . ':' . $apiKey)
351+
];
364352

365353
return $this;
366354
}

0 commit comments

Comments
 (0)