Hello,
We are trying to build a custom realm from the git example below
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