Simple authentication of the CamundaTaskListClient

I am using the GitHub - camunda-community-hub/camunda-tasklist-client-java: Java client for the Tasklist API of Camunda Platform 8 project inside of a SpringBoot application, that also uses the spring-boot-starter-camunda module. The reason for this BTW is that the Tasklist client is not yet supported natively like the Operate client is in the SB starter module. This may or may not be relevant to this issue.

The issue is when I attempt to authenticate the CamundaTaskListClient using simple authentication (user name and password) against a local SM Camunda instance I get an authentication error. It works against a SaaS instance.

Here is the code and a debugging session with the variable states:

When I step through the code into the SimpleAuthentication classes, you can see that the simpleUrl variable is null, and therefore the authUrl constructed from that is invalid.

There does not seem to be a way of setting this either in properties nor programatically that I can see at least. And even if I could what would it need to be set to?

Anyway this causes the following exception:

Caused by: java.lang.RuntimeException: Unable to authenticate
	at io.camunda.common.auth.SimpleAuthentication.retrieveToken(SimpleAuthentication.java:62) ~[java-common-8.3.4.jar:8.3.4]
	at java.base/java.util.HashMap.forEach(HashMap.java:1421) ~[na:na]
	at io.camunda.common.auth.SimpleAuthentication.build(SimpleAuthentication.java:43) ~[java-common-8.3.4.jar:8.3.4]
	at io.camunda.common.auth.SimpleAuthenticationBuilder.build(SimpleAuthenticationBuilder.java:17) ~[java-common-8.3.4.jar:8.3.4]
	at com.arcadis.config.CamundaLocalConfiguration.getCamundaTaskListClient(CamundaLocalConfiguration.java:46) ~[main/:na]
	at com.arcadis.config.CamundaLocalConfiguration$$SpringCGLIB$$0.CGLIB$getCamundaTaskListClient$0(<generated>) ~[main/:na]
	at com.arcadis.config.CamundaLocalConfiguration$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[main/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-6.1.1.jar:6.1.1]
	at com.arcadis.config.CamundaLocalConfiguration$$SpringCGLIB$$0.getCamundaTaskListClient(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.1.jar:6.1.1]
	... 34 common frames omitted

Here is my Gradle build file:

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.2.0'
	id 'io.spring.dependency-management' version '1.1.4'
	id 'checkstyle'
	id 'jacoco'
}

group = 'com.xxx'
version = '0.0.1-SNAPSHOT'

java {
	sourceCompatibility = '17'
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-security'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.flywaydb:flyway-core:10.4.1'
	implementation 'io.camunda.spring:spring-boot-starter-camunda:8.3.4'
	implementation 'io.camunda:camunda-tasklist-client-java:8.3.3.3'

	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testImplementation 'org.springframework.security:spring-security-test'
}

I am running against Camunda version 8.3.4.

Hello @Justin_Phillips
Thanks for your question,

Over the SM, authentication works in a different way in compare to SaaS,

SM does not support Simple Authentication, my recommendation is use over bearer JWT Token to auth. on SM

Hope it helps
Best regards.

Thanks for the update.

It might be an idea then to update the README file as it states that it does: GitHub - camunda-community-hub/camunda-tasklist-client-java: Java client for the Tasklist API of Camunda Platform 8

Hi @Justin_Phillips,

it does support it. On previous versions, this was part of the client itself. But since these mechanisms have been ported to the common sdk, I’ve removed them from the client and use the authentications from the common. You can find details about that switch in that commit : Remove custom Authentication mechanisms to rely on the https://github… · camunda-community-hub/camunda-tasklist-client-java@778ee71 · GitHub

Instead you have a nullPointer because you’re not providing tasklist url into the SimpleAuthentication (you’re right the readme had to be updated )

Authentication auth = SimpleAuthentication.builder().**simpleUrl("tasklistUrl")**.simpleConfig(simpleConfig).build();

Hope that helps!

1 Like