Setting a credential with "type":"authParamsString" — via DEKAF_DEFAULT_PULSAR_AUTH or a session credential — makes every binary-protocol connection fail with:
PulsarClientException$AuthenticationException: Failed to authenticate
This happens regardless of the auth plugin, and regardless of whether authParams is a literal value or a file:// reference. The same broker/token works fine with "type":"jwt".
Repro:
{"type":"authParamsString","authPluginClassName":"org.apache.pulsar.client.impl.auth.AuthenticationToken","authParams":"<valid token>"}
→ fails on connect/consume/produce.
{"type":"jwt","token":"<same token>"}
→ works.
Root cause: server/src/main/scala/pulsar_auth/Client.scala, configureAuth (used by makePulsarClient, the native binary-protocol client). The AuthParamsStringCredentials case only does:
pulsarClientConfig.setAuthPluginClassName(cr.authPluginClassName)
pulsarClientConfig.setAuthParams(cr.authParams)
Unlike the Jwt/OAuth2 cases just above it, it never calls setAuthentication(...) with an actual Authentication object. Since the client is built directly via PulsarClientImpl.builder().conf(pulsarClientConfig)...build() (bypassing ClientBuilderImpl, which normally does this string→object conversion), the raw strings never become a live Authentication instance — the client connects with none attached.
Suggested fix:
case cr: AuthParamsStringCredentials =>
pulsarClientConfig.setAuthPluginClassName(cr.authPluginClassName)
pulsarClientConfig.setAuthParams(cr.authParams)
pulsarClientConfig.setAuthentication(AuthenticationFactory.create(cr.authPluginClassName, cr.authParams))
Setting a credential with
"type":"authParamsString"— viaDEKAF_DEFAULT_PULSAR_AUTHor a session credential — makes every binary-protocol connection fail with:PulsarClientException$AuthenticationException: Failed to authenticate
This happens regardless of the auth plugin, and regardless of whether
authParamsis a literal value or afile://reference. The same broker/token works fine with"type":"jwt".Repro:
{"type":"authParamsString","authPluginClassName":"org.apache.pulsar.client.impl.auth.AuthenticationToken","authParams":"<valid token>"} → fails on connect/consume/produce. {"type":"jwt","token":"<same token>"} → works. Root cause: server/src/main/scala/pulsar_auth/Client.scala, configureAuth (used by makePulsarClient, the native binary-protocol client). The AuthParamsStringCredentials case only does: pulsarClientConfig.setAuthPluginClassName(cr.authPluginClassName) pulsarClientConfig.setAuthParams(cr.authParams) Unlike the Jwt/OAuth2 cases just above it, it never calls setAuthentication(...) with an actual Authentication object. Since the client is built directly via PulsarClientImpl.builder().conf(pulsarClientConfig)...build() (bypassing ClientBuilderImpl, which normally does this string→object conversion), the raw strings never become a live Authentication instance — the client connects with none attached. Suggested fix: case cr: AuthParamsStringCredentials => pulsarClientConfig.setAuthPluginClassName(cr.authPluginClassName) pulsarClientConfig.setAuthParams(cr.authParams) pulsarClientConfig.setAuthentication(AuthenticationFactory.create(cr.authPluginClassName, cr.authParams))