# Elasticsearch 6.0.0 Base64 not found

**URL:** <https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942>\
**Category:** Elasticsearch\
**Created:** [February 1, 2018, 6:40am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942 "2018-02-01T06:40:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajit](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@ajit](https://discuss.elastic.co/u/ajit)\
**Post date:** [February 1, 2018, 6:40am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/1 "2018-02-01T06:40:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 1, 2018, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/2 "2018-02-01T07:19:49Z")

</div>

You can probably use JDK standard classes like [https://docs.oracle.com/javase/8/docs/api/java/util/Base64.Encoder.html#encodeToString-byte:A-](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?

---

<div class="post-metadata">

**Author:** ![ajit](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@ajit](https://discuss.elastic.co/u/ajit)\
**Post date:** [February 1, 2018, 7:38am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/3 "2018-02-01T07:38:55Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 1, 2018, 7:53am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/4 "2018-02-01T07:53:11Z")

</div>

Please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) 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.

> [@How to pass username and password using transport client](https://discuss.elastic.co/t/how-to-pass-username-and-password-using-transport-client/117938):
>
> Hi, I am using search guard on elasticsearch. In my java code i have used Transport client. But I am not able to access index. Exception is ElasticsearchSecurityException[No user found for indices:data/read/search]. I want to provide username and password with client. Please provide solution to pass username and password.

> [@Transport client not working with search guard](https://discuss.elastic.co/t/transport-client-not-working-with-search-guard/117745):
>
> Hi, I have successfully implemented searchguard in elasticsearch. But from java side Transport client not working now. Below is my configuration. Settings settings = Settings.builder() .put("[cluster.name](http://cluster.name)", "searchguard\_demo") .put(SSLConfigConstants.SEARCHGUARD\_SSL\_TRANSPORT\_KEYSTORE\_FILEPATH,"C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode.pem") .put(SSLConfigConstants.SEARCHGUARD\_SSL\_TRANSPORT\_TRUSTSTORE\_FILEPATH, "C:\Users\c-ajitb\Desktop\SearchguardFiles\esnode-key.pem") .put(SSLConfi…

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.

---

<div class="post-metadata">

**Author:** ![ajit](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@ajit](https://discuss.elastic.co/u/ajit)\
**Post date:** [February 1, 2018, 7:54am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/5 "2018-02-01T07:54:49Z")

</div>

Ok Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 1, 2018, 7:54am UTC](https://discuss.elastic.co/t/elasticsearch-6-0-0-base64-not-found/117942/6 "2018-03-01T07:54:50Z")

</div>

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