Securing pages with Keycloak (Vaadin 8)

I have a few pages that I would like to secure with Keycloak.
I managed to do this with a Springboot app, but it just isn’t working with Vaadin 8…doesn’t anyone here have experience with this?

Basically the redirect to Keycloak isn’t done and the pages are just being displayed…
Any help is welcome!

It would likely help if you could provide some code so we can see what you are doing.

I have several problems.
The way I see it, there are 2 ways of securing your app with keycloak (correct me if I’m wrong!), either with a webserver adapter (Tomcat in my case) or by adding some configuration in your application. They both seem to fail…

When I try to add the adapter in Tomcat I get the following error:

"Cannot configure an authenticator for method [KEYCLOAK]

→ the error seems to indicate that the adapter isn’t properyl installed, but what else besides adding the jars to my lib-folder can I do?

I followed all the steps here;

Added the jars to Tomcat’s lib folder. Added a context.xml

<Context path="/your-context-path">
    <Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>

→ I’m not sure though what to fill in path=“”?

Added keycloak.json to my WEB-INF-folder

  "realm": "myrealm",
  "auth-server-url": "myurl/auth",
  "resource": "testclient",
  "enable-basic-auth": true,
  "credentials" : {
    "secret" : "my-secret"

And added this to my web.xml




Or the second method is adding an to your project and a KeycloakConfig-class
But here the problem is that the application does not use Spring, it is a plain old ‘legacy’ Vaadin 8 project. All the examples I find are using Spring or Spring Boot. But turning this, fairly large, project from Vaadin 8 to a Vaadin Spring project will be very cumbersome I think…