Elasticsearch 6.0.0 Base64 not found

Hi,
I am using elasticsearch 6.0.0. I want to encode username and password using Base64. But there is no Base64 class present in jar. Please reply.

client.threadPool().getThreadContext().putHeader("Authorization", "Basic "+encodeBase64("username:password"));

Above code I have to use in elasticsearch 6.0.0

You can probably use JDK standard classes like https://docs.oracle.com/javase/8/docs/api/java/util/Base64.Encoder.html#encodeToString-byte:A-

BTW why using a 6.0.0 instead of 6.1.3?

Hi,
Transport client configuration is like below.

Hi,
I am using searchguard 6. And from java side I have implemented below configuration.
Settings settings = Settings.builder()
.put("cluster.name", "searchguard_demo")
.put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_PEMCERT_FILEPATH,"C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode.pem")
.put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_PEMKEY_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode-key.pem")
.put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_PEMTRUSTEDCAS_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\root-ca.pem")
.put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_ENFORCE_HOSTNAME_VERIFICATION, "false")
.put(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_ENABLED, "true")
.put(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_PEMCERT_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode.pem")
.put(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_PEMKEY_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode-key.pem")
.put(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\root-ca.pem")

TransportClient transclient = new PreBuiltTransportClient(settings,SearchGuardSSLPlugin.class).addTransportAddress(new TransportAddress(InetAddress.getByName("172.21.153.176"), 9300));
transclient.threadPool().getThreadContext().putHeader("Authorization", "Basic "+Base64.getEncoder().encodeToString("admin:admin".getBytes()));
GetResponse getResponse = transclient.prepareGet("testindex", "testtype", "1").get();
System.out.println("Response="+getResponse.getSource());

But I am getting below exception.
ElasticsearchSecurityException[No user found for indices:data/read/get]

I have given admin credentials.
Please reply and provide solution.

Thanks,
Ajit

Please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Please edit your post.

This new question is not related to the first one and I think you already asked for this in another threads.

Please don't do this and keep the discussion where you opened it.
If you don't get answers about a non official and not supported plugin, that might be better to ask the authors directly on their website about this IMHO.

Ok Thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.