# Shield embedded integration tests support

**URL:** <https://discuss.elastic.co/t/shield-embedded-integration-tests-support/31859>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [October 8, 2015, 2:52pm UTC](https://discuss.elastic.co/t/shield-embedded-integration-tests-support/31859 "2015-10-08T14:52:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avibh](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@avibh](https://discuss.elastic.co/u/avibh)\
**Post date:** [October 8, 2015, 2:52pm UTC](https://discuss.elastic.co/t/shield-embedded-integration-tests-support/31859/1 "2015-10-08T14:52:20Z")

</div>

Hi,

I've been using elasticsearch as a local (embedded) node for my integration tests through the following code

```
Node node = nodeBuilder().local(true).node();
Client client = node.client();
return client;

```

now that Shield is on board I want to run my tests with user authorization.  
how do I run my embedded ES with Shield?  
currently I'm using ES 1.5.1, not planning on moving to 2.0beta yet.

thanks

---

<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:** [October 9, 2015, 2:13pm UTC](https://discuss.elastic.co/t/shield-embedded-integration-tests-support/31859/2 "2015-10-09T14:13:34Z")

</div>

Hi,

When using Shield, the local transport is not supported and we recommend using a transport client to connect to the cluster. Additionally, with Shield you will need to add a user for your tests or provide some configuration around authentication such as LDAP and role mapping depending on what you would like to test.

I would suggest that your test start up a node with the appropriate settings and then you can create a transport client to connect to the node in your test. If you plan to use the esusers realm, you can pre-populate the users and users\_roles files and then [configure](https://www.elastic.co/guide/en/shield/current/esusers.html#_literal_esusers_literal_realm_settings) the esusers realm to use those files. Additionally, you will also need a roles.yml file with the role definitions that you wish to use and that location can be configured via the `shield.authz.store.file.roles` [setting](https://www.elastic.co/guide/en/shield/current/reference.html).

---

<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:** [July 6, 2017, 1:48pm UTC](https://discuss.elastic.co/t/shield-embedded-integration-tests-support/31859/3 "2017-07-06T13:48:17Z")

</div>


