# Issues Custom Realm in Elastic Search 6.0.0

**URL:** <https://discuss.elastic.co/t/issues-custom-realm-in-elastic-search-6-0-0/119192>\
**Category:** Elasticsearch\
**Created:** [February 9, 2018, 9:02am UTC](https://discuss.elastic.co/t/issues-custom-realm-in-elastic-search-6-0-0/119192 "2018-02-09T09:02:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avanika24](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@avanika24](https://discuss.elastic.co/u/avanika24)\
**Post date:** [February 9, 2018, 9:02am UTC](https://discuss.elastic.co/t/issues-custom-realm-in-elastic-search-6-0-0/119192/1 "2018-02-09T09:02:09Z")

</div>

Hello,

We are trying to build a custom realm from the git example below

> **[elastic/shield-custom-realm-example](https://github.com/elastic/shield-custom-realm-example)**
>
> Contribute to shield-custom-realm-example development by creating an account on GitHub.

But in our case we do not have user name and passwords.  
We authenticate based on the X509 certificate of the user.

We changed the above for our purpose and created a elasticsearch.zip file and tried and installed the plugin.

The zip contains the customrealm.jar and other dependent jars.

But I am getting classcast exception on my elastic search server start up:

C:\Apps\elasticsearch-6.0.0\bin\>elasticsearch.bat  
[2018-02-09T12:39:15,770][INFO][o.e.n.Node] [] initializing ...  
[2018-02-09T12:39:15,960][INFO][o.e.e.NodeEnvironment] [Y9ne1Ev] using [1] data paths, mounts [[IBUILD (C:)]], net usable\_space [110.6gb], net total\_space [249.9gb]  
[2018-02-09T12:39:15,966][INFO][o.e.e.NodeEnvironment] [Y9ne1Ev] heap size [990.7mb], compressed ordinary object pointers [true]  
[2018-02-09T12:39:16,797][INFO][o.e.n.Node] node name [Y9ne1Ev] derived from node ID [Y9ne1Ev8QuaRoiUWb8mQVA]; set [node.name] to override  
[2018-02-09T12:39:16,801][INFO][o.e.n.Node] version[6.0.0], pid[40588], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Windows 7/6.1/amd64], JVM[Oracle Corp  
Server VM/1.8.0\_112/25.112-b15]  
[2018-02-09T12:39:16,803][INFO][o.e.n.Node] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSIni  
ysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptim  
er.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Delasticsearch, -Des.path.home=C:\Apps\elastic  
\Apps\elasticsearch-6.0.0\config]  
[2018-02-09T12:39:19,004][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]  
org.elasticsearch.bootstrap.StartupException: java.lang.ClassCastException: class com.csg.dpb.dpbpersonalizationandsearch.elastic.cspkiaura.CsPkiAuraRealmPlugin  
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:134) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.0.0.jar:6.0.0]  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.0.0.jar:6.0.0]  
Caused by: java.lang.ClassCastException: class com.csg.dpb.dpbpersonalizationandsearch.elastic.cspkiaura.CsPkiAuraRealmPlugin  
at java.lang.Class.asSubclass(Class.java:3404) ~[?:1.8.0\_112]  
at org.elasticsearch.plugins.PluginsService.loadPluginClass(PluginsService.java:419) ~[elasticsearch-6.0.0.jar:6.0.0]

My CsPkiAuraRealmPlugin looks like this.  
public class CsPkiAuraRealmPlugin extends XPackExtension {

```
@Override
public String name() {
    return "CS PKI Aura Realm prototype";
}

@Override
public String description() {
    return "prototype of a PKI realm with custom entitlements - to be integrated with CS Aura";
}

@Override
public Map<String, Realm.Factory> getRealms(ResourceWatcherService resourceWatcherService) {
    return new MapBuilder<String, Realm.Factory>()
            .put(RealmConstants.REALM_TYPE, new CsPkiAuraRealmFactory())
            .immutableMap();
}

@Override
public AuthenticationFailureHandler getAuthenticationFailureHandler() {
    return new CsPkiAuraAuthenticationFailureHandler();
}

```

}

We are facing lots of issues here. Can somebody help us

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [February 9, 2018, 11:10am UTC](https://discuss.elastic.co/t/issues-custom-realm-in-elastic-search-6-0-0/119192/2 "2018-02-09T11:10:35Z")

</div>

It looks like you tried to install your custom realm as if were an elasticsearch plugin, but it's not.  
You need to install it as an XPackExtension, using the `bin/x-pack/extension` command.

---

<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 9, 2018, 11:10am UTC](https://discuss.elastic.co/t/issues-custom-realm-in-elastic-search-6-0-0/119192/3 "2018-03-09T11:10:58Z")

</div>

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