<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div style="font-size: 12.0px;font-family: standard;">Hy everyone!</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;">We are trying to secure an embedded restfull Jetty-Application with Keycloak. We have </div>
<div style="font-size: 12.0px;font-family: standard;">managed to redirect to the Keycloak server when a secured area on our webservice is called as also our service is called/redirected to, after login. </div>
<div style="font-size: 12.0px;font-family: standard;">However after successfull login, we get an NullPointerException (below). </div>
<div style="font-size: 12.0px;font-family: standard;">What we have debugged so far: Stateless is required, therefore we are using cookie-tokenstore. The informations are set correctly to the cookie. However it seams this informations are not assigned to/by the adapter during the redirect request.</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;">Did anyone run into the same error? Any help/hint would be appreciated! Thanks</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;">[WARN ] 2016-02-15 16:29:55.884 [pool-2-thread-18] HttpChannel - /</div>
<div style="font-size: 12.0px;font-family: standard;">java.lang.NullPointerException</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.keycloak.adapters.jetty.core.AbstractKeycloakJettyAuthenticator.createIdentity(AbstractKeycloakJettyAuthenticator.java:110) ~[keycloak-jetty-core-1.8.1.Final.jar:1.8.1.Final]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.keycloak.adapters.jetty.core.AbstractKeycloakJettyAuthenticator.register(AbstractKeycloakJettyAuthenticator.java:289) ~[keycloak-jetty-core-1.8.1.Final.jar:1.8.1.Final]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.keycloak.adapters.jetty.core.AbstractKeycloakJettyAuthenticator.validateRequest(AbstractKeycloakJettyAuthenticator.java:257) ~[keycloak-jetty-core-1.8.1.Final.jar:1.8.1.Final]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:512) ~[jetty-security-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.server.Server.handle(Server.java:497) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.10.v20150310.jar:9.2.10.v20150310]</div>
<div style="font-size: 12.0px;font-family: standard;"> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_72]</div>
<div style="font-size: 12.0px;font-family: standard;"> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_72]</div>
<div style="font-size: 12.0px;font-family: standard;"> at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;">Our adapterconfiguration looks like this:</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;"> KeycloakJettyAuthenticator keycloakAuthenticator = new KeycloakJettyAuthenticator();</div>
<div style="font-size: 12.0px;font-family: standard;"> AdapterConfig keycloakAdapterConfig = new AdapterConfig();</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setRealm("myRealm");</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setRealmKey("MIIBIjANB ... RsvQIDAQAB");</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setAuthServerUrl("<a href="https://3c.gmx.net/mail/client/dereferrer?redirectUrl=http%3A%2F%2Flocalhost%3A8080%2Fauth%2522" target="_blank">http://localhost:8080/auth"</a>);</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setSslRequired("external");</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setResource("myRealmClient");</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setPublicClient(true);</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setUseResourceRoleMappings(true);</div>
<div style="font-size: 12.0px;font-family: standard;"> keycloakAdapterConfig.setTokenStore("cookie");</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;">And to the pom.xml we added following dependecies:</div>
<div style="font-size: 12.0px;font-family: standard;"> </div>
<div style="font-size: 12.0px;font-family: standard;"><dependency></div>
<div style="font-size: 12.0px;font-family: standard;"> <groupId>org.keycloak</groupId></div>
<div style="font-size: 12.0px;font-family: standard;"> <artifactId>keycloak-jetty92-adapter</artifactId></div>
<div style="font-size: 12.0px;font-family: standard;"> <version>1.8.1.Final</version></div>
<div style="font-size: 12.0px;font-family: standard;"></dependency></div>
<div style="font-size: 12.0px;font-family: standard;"><dependency></div>
<div style="font-size: 12.0px;font-family: standard;"> <groupId>org.keycloak</groupId></div>
<div style="font-size: 12.0px;font-family: standard;"> <artifactId>keycloak-core</artifactId></div>
<div style="font-size: 12.0px;font-family: standard;"> <version>1.8.1.Final</version></div>
<div style="font-size: 12.0px;font-family: standard;"></dependency></div>
<div style="font-size: 12.0px;font-family: standard;"><dependency></div>
<div style="font-size: 12.0px;font-family: standard;"> <groupId>org.keycloak</groupId></div>
<div style="font-size: 12.0px;font-family: standard;"> <artifactId>keycloak-services</artifactId></div>
<div style="font-size: 12.0px;font-family: standard;"> <version>1.8.1.Final</version></div>
<div style="font-size: 12.0px;font-family: standard;"></dependency></div>
</div></div></body></html>