Integrate Keycloak with Camunda

Continuing the discussion from Integrate Keycloak with Camunda - custom permissions:

Hello @Drago_Mazic,
I am trying to integrate Keycloak and Camunda7 but I am not able to do,
I am not getting a proper starting point as camunda and spring security are clasing and Keycloak as well. So could you please guide me through it as you have done integration before.

Kind Regards,
Shoeb Sayyed

@shoebsayyed118 This topic might help you:

Thanks for the reply @aravindhrs the article was very helpful
but I am not able to start the service as I am getting the following exceptions
Cannot instantiate authentication filter: authentication provider not found

javax.servlet.ServletException: Cannot instantiate authentication filter: authentication provider not found
at org.camunda.bpm.webapp.impl.security.auth.ContainerBasedAuthenticationFilter.init(ContainerBasedAuthenticationFilter.java:64) ~[camunda-webapp-7.19.0-classes.jar:7.19.0]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:272) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:106) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4609) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5248) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.71.jar:9.0.71]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:481) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.25.jar:5.3.25]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.9.jar:2.7.9]
at com.example.workflow.Application.main(Application.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: de.accso.camunda.showcase.sso.KeycloakAuthenticationProvider
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:375) ~[na:na]
at org.camunda.bpm.webapp.impl.security.auth.ContainerBasedAuthenticationFilter.init(ContainerBasedAuthenticationFilter.java:61) ~[camunda-webapp-7.19.0-classes.jar:7.19.0]
… 40 common frames omitted

2023-08-11 23:40:53.178 ERROR 32012 — [ main] o.apache.catalina.core.StandardContext : One or more Filters failed to start. Full details will be found in the appropriate container log file
2023-08-11 23:40:53.179 ERROR 32012 — [ main] o.apache.catalina.core.StandardContext : Context [] startup failed due to previous errors
2023-08-11 23:40:53.306 INFO 32012 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-08-11 23:40:53.312 WARN 32012 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2023-08-11 23:40:53.331 INFO 32012 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-08-11 23:40:53.378 ERROR 32012 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.25.jar:5.3.25]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.9.jar:2.7.9]
at com.example.workflow.Application.main(Application.java:10) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:481) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.9.jar:2.7.9]
… 8 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.7.9.jar:2.7.9]
… 13 common frames omitted

Yaml Config as follows
spring.datasource.url: jdbc:h2:file:./camunda-h2-database

spring.security.user.name: demo
spring.security.user.password: demo

server.port : 3030

security:
basic:
enabled: false
oauth2:
client:
client-id: camunda-identity-service
client-secret: *************************************
useUsernameAsCamundaUserId: false
accessTokenUri: https://<domain.com>/auth/realms/camunda/protocol/openid-connect/token
userAuthorizationUri: http://<domain.com>/auth/realms/camunda/protocol/openid-connect/auth
scope: openid profile email
resource:
userInfoUri: http://<domain.com>/auth/realms/camunda/protocol/openid-connect/userinfo

Hi @shoebsayyed118 ,
Regarding that log error, it seems you didn’t extended ContainerBasedAuthenticationProvider.class. I got same response when I removed that class.

Have you tried following the steps from plugin readme ? There are instructions which classes you need to extend, and how to set up keycloak.

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