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;
https://www.keycloak.org/docs/latest/securing_apps/#_tomcat_adapter
Added the jars to Tomcat’s lib folder. Added a context.xml
<Context path="/your-context-path">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>
→ 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
<security-constraint>
<web-resource-collection>
<web-resource-name>login-test</web-resource-name>
<url-pattern>/test</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>KEYCLOAK</auth-method>
<realm-name>testing</realm-name>
</login-config>
<security-role>
<role-name>member</role-name>
</security-role>
Or the second method is adding an application.properties-file 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…