# Upgrading from Shield to X-Pack, FilterClient and authentication headers

**URL:** <https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205>\
**Category:** Elasticsearch\
**Created:** [November 7, 2016, 11:39am UTC](https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205 "2016-11-07T11:39:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![djmcgreal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djmcgreal/32/52956_2.png) [@djmcgreal](https://discuss.elastic.co/u/djmcgreal)\
**Post date:** [November 7, 2016, 11:39am UTC](https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205/1 "2016-11-07T11:39:10Z")

</div>

Hi X-Pack Security users,

In Shield 2.4 I have a setup whereby my Client authenticates as a transport\_client user, and the Authorization header is added to each request using a FilterClient.

I would like to carry this approach over to X-Pack, however the ActionRequest class no longer has a putHeader method. The documentation at [https://www.elastic.co/guide/en/x-pack/current/java-clients.html](https://www.elastic.co/guide/en/x-pack/current/java-clients.html) claims that you can putHeader when the requests are built, but this method does not seem to exist.

I appreciate any help you can offer.  
Best, Dan.

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [November 7, 2016, 11:54am UTC](https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205/2 "2016-11-07T11:54:12Z")

</div>

Hey Dan,

Sorry about that documentation error; we'll get that corrected. The way to do this in x-pack is:

```
PreBuiltXPackTransportClient = new PreBuiltXPackTransportClient(Settings.builder()....build());
String token = basicAuthHeaderValue("test_user", new SecuredString("changeme".toCharArray()));
SearchResponse response = client.filterWithHeader(Collections.singletonMap("Authorization", token)).prepareSearch().get();

```

Jay

---

<div class="post-metadata">

**Author:** ![djmcgreal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djmcgreal/32/52956_2.png) [@djmcgreal](https://discuss.elastic.co/u/djmcgreal)\
**Post date:** [November 7, 2016, 12:11pm UTC](https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205/3 "2016-11-07T12:11:19Z")

</div>

Thanks. Your swift responses make up for any inaccuracies in the documentation. Thanks for your efforts!  
Best, Dan.

---

<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:** [December 5, 2016, 12:11pm UTC](https://discuss.elastic.co/t/upgrading-from-shield-to-x-pack-filterclient-and-authentication-headers/65205/4 "2016-12-05T12:11:55Z")

</div>

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