Hi All, We use kafka with OAuth2 authentication for our product. Due to the issue mentioned here, we had to package jose4j-0.9.6 for OAuth2 functionality to work.
I read somewhere that setting: props.put( *"sasl.oauthbearer.jwt.validator.class", "org.apache.kafka.common.security.oauthbearer.ClientJwtValidator"* ); will solve the above issue - as in we dont need to package OAuth2 anymore in that case. Please let me know if there is a KIP or any other document where this is outlined. I tried the above and could see that kafka OAuth2 authentication works fine - without needing to package jose4j-0.9.6 Thanks, Subra. On Fri, Feb 13, 2026 at 5:27 PM Christian Semaan (Jira) <[email protected]> wrote: > Christian Semaan created KAFKA-20184: > ---------------------------------------- > > Summary: jose4j marked as compileOnly in clients module > causes ClassNotFoundException at runtime for OAuth authentication > Key: KAFKA-20184 > URL: https://issues.apache.org/jira/browse/KAFKA-20184 > Project: Kafka > Issue Type: Bug > Components: clients > Affects Versions: 3.1.0 > Reporter: Christian Semaan > > > The `jose4j` library is currently marked as `compileOnly` in the > `:clients` module dependency configuration > https://github.com/apache/kafka/blob/4.1/build.gradle#L1819, with a > comment stating "only used by broker". However, this is incorrect and > causes runtime issues. > > OAuth implementation classes are in the clients module, not just broker: * > org.apache.kafka.common.security.oauthbearer.internals.secured.CloseableVerificationKeyResolver > (interface extending jose4j's VerificationKeyResolver) > * > org.apache.kafka.common.security.oauthbearer.internals.secured.JwksFileVerificationKeyResolver > * > org.apache.kafka.common.security.oauthbearer.internals.secured.RefreshingHttpsJwksVerificationKeyResolver > > Impact: > Runtime Failure: When Kafka clients are used with SASL/OAUTHBEARER > authentication, the application will encounter `ClassNotFoundException` or > `NoClassDefFoundError` for jose4j classes at runtime unless users manually > add jose4j as a dependency to their applications. > > > > > -- > This message was sent by Atlassian Jira > (v8.20.10#820010) >
