[
https://issues.apache.org/jira/browse/BEAM-12012?focusedWorklogId=576478&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-576478
]
ASF GitHub Bot logged work on BEAM-12012:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Apr/21 19:12
Start Date: 03/Apr/21 19:12
Worklog Time Spent: 10m
Work Description: fcaylus commented on a change in pull request #14345:
URL: https://github.com/apache/beam/pull/14345#discussion_r606699782
##########
File path:
sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java
##########
@@ -424,6 +460,14 @@ RestClient createClient() throws IOException {
httpAsyncClientBuilder ->
httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
}
+ if (getApiKey() != null) {
+ restClientBuilder.setDefaultHeaders(
+ new Header[] {new BasicHeader("Authorization", "ApiKey " +
getApiKey())});
Review comment:
After some research, there is no way in the Elasticsearch SDK to
retrieve the headers of a request (or the default headers of the `RestClient`).
I don't think there is an "easy way" to test it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 576478)
Time Spent: 1h (was: 50m)
> ElasticsearchIO - Add API key & bearer token authentication
> -----------------------------------------------------------
>
> Key: BEAM-12012
> URL: https://issues.apache.org/jira/browse/BEAM-12012
> Project: Beam
> Issue Type: Improvement
> Components: io-java-elasticsearch
> Reporter: Fabien Caylus
> Assignee: Fabien Caylus
> Priority: P3
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Hello !
> Currently, only username/password authentication is supported in this IO.
> However, Elasticsearch also supports:
> * [API
> key|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html],
> since version 6.7
> * [Bearer
> token|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html],
> since version 6.3
> Supporting them would allow the user to create specific keys or tokens (with
> specific permissions and validity period) and use them for its jobs.
> However, both features are not opensource themselves inside Elasticsearch
> (part of the X-Pack solution, under the Elastic license). But for the
> implementation in Beam, it's only a matter of setting the correct
> {{Authorization}} header. So I think it should be ok to implement them.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)