Skip to main content
Use the following information to configure your Kafka clients to use the OAuth2 authentication mechanism for connecting to StreamNative Cloud clusters.
The OAuth2 authentication mechanism is currently only validated for Java clients with io.streamnative.pulsar.handlers.kop.security.oauth.OauthLoginCallbackHandler callback handler.OIDC Federation is not fully supported for Kafka clients yet. The support is under development.

Prerequisites

  • Apache Kafka client: 3.2.1 or later
  • Include the following dependencies in your pom.xml file:

Service URLs

In order to connect to a StreamNative Cloud cluster, you need to get its service URLs.
You can get a cluster’s service URLs by following the steps below:
  1. Navigate to the Cluster Workspace page.
  2. Navigate to the Details tab, and in the Access Points section, you can find all the available service URLs of this cluster. Click Copy at the end of the row of the service URL to copy the URL.
  • Kafka Service URL (TCP): The URL of Kafka service.
  • Kafka Schema Registry URL (HTTPS): The URL of Kafka schema registry service.

JAAS configuration options

Before configuring your Kafka clients to use OAuth 2.0 for connecting to StreamNative Cloud clusters, you need to prepare a JAAS configuration for your clients by following the steps below. Several configuration options are available for the callback handler. Sensitive configuration options and SASL extensions are included in the JAAS configuration file (sasl.jaas.config) while the others are top-level configurations.

Configure Kafka Clients

The section describes how to configure Kafka clients to use OAuth 2.0 for connecting to StreamNative Cloud clusters. In this doc, we use urn:sn:pulsar:my_org:my_instance as the instance for an example.
  • For StreamNative OAuth2, audience is required.

Examples