Custom Realm Extension for X-Pack
We have opened X-Pack which gives you access to the source code for the X-Pack SecurityExtension feature, and also our test cases for that.
Those test cases are maintained on an ongoing basis, and will always match the latest state of the X-Pack code. As such, we are no longer maintaining this sample realm repository. If you wish to see an example realm, you can see a working, maintained example in the Elasticsearch repository
The blog post How to Develop Your Own Security Extensions and Custom Realms for Elasticsearch also provides an example for implementing a custom realm in Elasticsearch 6.3 or above, with commentary to assist.
Elasticsearch Versions and Branches
The “master” branch of the Elasticsearch git repository tracks the most recent deveopment, including unreleased features and changes. The security extension example from
master is unlikely to work on any released version of Elasticsearch.
It is important that you browse to the correct version/branch for the version of Elasticsearch that you are running.
Older versions of Elasticsearch
This repository contains versions of the custom realm extension that work with Elasticsearch releases from as far back as 2.0
Creating an X-Pack Extension
For versions prior to 6.3 please follow the instructions in the
README.textile file on the correct branch of this repository (see table above).
For versions 6.3.0 and later, Security Extensions have changed and can be loaded using standard Elasticsearch plugin mechanisms.
Please read Elasticsearch’s plugin author instructions
In order to registry your
SecurityExtension with X-Pack, it must be included in the
resources/META-INF/services/org.elasticsearch.xpack.core.security.SecurityExtension file of your main jar file, as per the example project
If you have questions about custom realms, please join us in our discussion forums where we will be able to help you.