conduktor / azure-kafka-oauthbearer

Kafka `CallbackHandler` implementation to support Azure Managed Identity
Apache License 2.0
2 stars 0 forks source link

Kafka Azure OAuthBearer Login CallbackHandler

Release License twitter

This library provides a Kafka login callback handler for Azure Managed Identity with supports for both client certificate and environment variable authentication.

The library is based on the [Azure Identity]() library and is already integrated into Conduktor Console 1.23+ and Conduktor Gateway 3.1+.

Usage

Add the dependency

Check the latest version on the releases page.

Maven

<dependency>
    <groupId>io.conduktor</groupId>
    <artifactId>azure-kafka-oauthbearer</artifactId>
    <version>0.2.0</version>
</dependency>

<repositories>
    <repository>
        <id>conduktor-github</id>
        <name>GitHub Conduktor Apache Maven Packages</name>
        <url>https://maven.pkg.github.com/conduktor/_/</url>
    </repository>
</repositories>

sbt

resolvers += s"GitHub Conduktor Apache Maven Packages" at s"https://maven.pkg.github.com/conduktor/_/"

libraryDependencies += "io.conduktor" % "azure-kafka-oauthbearer" % "0.2.0"

Client certificate authentication

Use client certificate authentication to retrieve auth token bearer.
More details on Azure identity ClientCertificateCredential documentation

Certificate without passphrase

Use io.conduktor.kafka.security.oauthbearer.azure.AzureManagedIdentityCallbackHandler as the callback handler class and provide the following required parameters in the sasl.jaas.config property :

Certificate with passphrase

Same as above but with the optional certificatePass parameter to provide the passphrase of the certificate.

sasl.login.callback.handler.class=io.conduktor.kafka.security.oauthbearer.azure.AzureManagedIdentityCallbackHandler
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required clientId=<clientId> tenantId=<tenantId> certificate=<pfx cert path> certificatePass=<cert passphrase> scope="https://<resource>/.default";

Environment variable client certification

Use Azure default environment variables to configure token auth bearer retriever. More details on Azure identity EnvironmentCredential documentation

Use io.conduktor.kafka.security.oauthbearer.azure.AzureManagedIdentityCallbackHandler as the callback handler class and provide the following required parameters in the sasl.jaas.config property :

The rest of the parameters are read from the environment variables.

sasl.login.callback.handler.class=io.conduktor.kafka.security.oauthbearer.azure.AzureManagedIdentityCallbackHandler
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required scope="https://<resource>/.default";

Other authentication methods

Other authentication methods are supported yet and could be added in the future.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.